Q00190_LostDream.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.Q00190_LostDream;
  20. import quests.Q00187_NikolasHeart.Q00187_NikolasHeart;
  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. /**
  26. * Lost Dream (190)
  27. * @author ivantotov
  28. */
  29. public final class Q00190_LostDream extends Quest
  30. {
  31. // NPCs
  32. private static final int JURIS = 30113;
  33. private static final int HEAD_BLACKSMITH_KUSTO = 30512;
  34. private static final int MAESTRO_NIKOLA = 30621;
  35. private static final int RESEARCHER_LORAIN = 30673;
  36. // Misc
  37. private static final int MIN_LEVEL = 42;
  38. private static final int MAX_LEVEL_FOR_EXP_SP = 48;
  39. public Q00190_LostDream()
  40. {
  41. super(190, Q00190_LostDream.class.getSimpleName(), "Lost Dream");
  42. addStartNpc(HEAD_BLACKSMITH_KUSTO);
  43. addTalkId(HEAD_BLACKSMITH_KUSTO, RESEARCHER_LORAIN, MAESTRO_NIKOLA, JURIS);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. final QuestState qs = getQuestState(player, false);
  49. if (qs == null)
  50. {
  51. return null;
  52. }
  53. String htmltext = null;
  54. switch (event)
  55. {
  56. case "30512-03.htm":
  57. {
  58. if (qs.isCreated())
  59. {
  60. qs.startQuest();
  61. qs.setMemoState(1);
  62. htmltext = event;
  63. }
  64. break;
  65. }
  66. case "30512-06.html":
  67. {
  68. if (qs.isMemoState(2))
  69. {
  70. qs.setMemoState(3);
  71. qs.setCond(3, true);
  72. htmltext = event;
  73. }
  74. break;
  75. }
  76. case "30113-02.html":
  77. {
  78. if (qs.isMemoState(1))
  79. {
  80. htmltext = event;
  81. }
  82. break;
  83. }
  84. case "30113-03.html":
  85. {
  86. if (qs.isMemoState(1))
  87. {
  88. qs.setMemoState(2);
  89. qs.setCond(2, true);
  90. htmltext = event;
  91. }
  92. break;
  93. }
  94. }
  95. return htmltext;
  96. }
  97. @Override
  98. public String onTalk(L2Npc npc, L2PcInstance player)
  99. {
  100. final QuestState qs = getQuestState(player, true);
  101. final int memoState = qs.getMemoState();
  102. String htmltext = getNoQuestMsg(player);
  103. if (qs.isCreated())
  104. {
  105. if (npc.getId() == HEAD_BLACKSMITH_KUSTO)
  106. {
  107. final QuestState q187 = player.getQuestState(Q00187_NikolasHeart.class.getSimpleName());
  108. if ((q187 != null) && q187.isCompleted())
  109. {
  110. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30512-01.htm" : "30512-02.htm";
  111. }
  112. }
  113. }
  114. else if (qs.isStarted())
  115. {
  116. switch (npc.getId())
  117. {
  118. case HEAD_BLACKSMITH_KUSTO:
  119. {
  120. if (memoState == 1)
  121. {
  122. htmltext = "30512-04.html";
  123. }
  124. else if (memoState == 2)
  125. {
  126. htmltext = "30512-05.html";
  127. }
  128. else if ((memoState >= 3) && (memoState <= 4))
  129. {
  130. htmltext = "30512-07.html";
  131. }
  132. else if (memoState == 5)
  133. {
  134. htmltext = "30512-08.html";
  135. giveAdena(player, 109427, true);
  136. if (player.getLevel() < MAX_LEVEL_FOR_EXP_SP)
  137. {
  138. addExpAndSp(player, 309467, 20614);
  139. }
  140. qs.exitQuest(false, true);
  141. }
  142. break;
  143. }
  144. case JURIS:
  145. {
  146. if (memoState == 1)
  147. {
  148. htmltext = "30113-01.html";
  149. }
  150. else if (memoState == 2)
  151. {
  152. htmltext = "30113-04.html";
  153. }
  154. break;
  155. }
  156. case MAESTRO_NIKOLA:
  157. {
  158. if (memoState == 4)
  159. {
  160. qs.setMemoState(5);
  161. qs.setCond(5, true);
  162. htmltext = "30621-01.html";
  163. }
  164. else if (memoState == 5)
  165. {
  166. htmltext = "30621-02.html";
  167. }
  168. break;
  169. }
  170. case RESEARCHER_LORAIN:
  171. {
  172. if (memoState == 3)
  173. {
  174. qs.setMemoState(4);
  175. qs.setCond(4, true);
  176. htmltext = "30673-01.html";
  177. }
  178. else if (memoState == 4)
  179. {
  180. htmltext = "30673-02.html";
  181. }
  182. break;
  183. }
  184. }
  185. }
  186. else if (qs.isCompleted())
  187. {
  188. if (npc.getId() == HEAD_BLACKSMITH_KUSTO)
  189. {
  190. htmltext = getAlreadyCompletedMsg(player);
  191. }
  192. }
  193. return htmltext;
  194. }
  195. }