Q00191_VainConclusion.java 4.9 KB

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