Q00188_SealRemoval.java 4.9 KB

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