Q00192_SevenSignsSeriesOfDoubt.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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.Q00192_SevenSignsSeriesOfDoubt;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.quest.Quest;
  23. import com.l2jserver.gameserver.model.quest.QuestState;
  24. import com.l2jserver.gameserver.model.quest.State;
  25. /**
  26. * Seven Signs, Series of Doubt (192)
  27. * @author Adry_85
  28. */
  29. public final class Q00192_SevenSignsSeriesOfDoubt extends Quest
  30. {
  31. // NPCs
  32. private static final int HOLLINT = 30191;
  33. private static final int HECTOR = 30197;
  34. private static final int STAN = 30200;
  35. private static final int CROOP = 30676;
  36. private static final int UNIDENTIFIED_BODY = 32568;
  37. // Items
  38. private static final int CROOPS_INTRODUCTION = 13813;
  39. private static final int JACOBS_NECKLACE = 13814;
  40. private static final int CROOPS_LETTER = 13815;
  41. // Misc
  42. private static final int MIN_LEVEL = 79;
  43. public Q00192_SevenSignsSeriesOfDoubt()
  44. {
  45. super(192, Q00192_SevenSignsSeriesOfDoubt.class.getSimpleName(), "Seven Signs, Series of Doubt");
  46. addStartNpc(CROOP, UNIDENTIFIED_BODY);
  47. addTalkId(CROOP, STAN, UNIDENTIFIED_BODY, HECTOR, HOLLINT);
  48. registerQuestItems(CROOPS_INTRODUCTION, JACOBS_NECKLACE, CROOPS_LETTER);
  49. }
  50. @Override
  51. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  52. {
  53. final QuestState st = getQuestState(player, false);
  54. if (st == null)
  55. {
  56. return null;
  57. }
  58. String htmltext = null;
  59. switch (event)
  60. {
  61. case "30676-02.htm":
  62. {
  63. htmltext = event;
  64. break;
  65. }
  66. case "30676-03.html":
  67. {
  68. st.startQuest();
  69. htmltext = event;
  70. break;
  71. }
  72. case "video":
  73. {
  74. if (st.isCond(1))
  75. {
  76. st.setCond(2, true);
  77. player.showQuestMovie(8);
  78. startQuestTimer("back", 32000, npc, player);
  79. return "";
  80. }
  81. break;
  82. }
  83. case "back":
  84. {
  85. player.teleToLocation(81654, 54851, -1513);
  86. return "";
  87. }
  88. case "30676-10.html":
  89. case "30676-11.html":
  90. case "30676-12.html":
  91. case "30676-13.html":
  92. {
  93. if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE))
  94. {
  95. htmltext = event;
  96. }
  97. break;
  98. }
  99. case "30676-14.html":
  100. {
  101. if (st.isCond(6) && st.hasQuestItems(JACOBS_NECKLACE))
  102. {
  103. st.giveItems(CROOPS_LETTER, 1);
  104. st.takeItems(JACOBS_NECKLACE, -1);
  105. st.setCond(7, true);
  106. htmltext = event;
  107. }
  108. break;
  109. }
  110. case "30200-02.html":
  111. case "30200-03.html":
  112. {
  113. if (st.isCond(4))
  114. {
  115. htmltext = event;
  116. }
  117. break;
  118. }
  119. case "30200-04.html":
  120. {
  121. if (st.isCond(4))
  122. {
  123. st.setCond(5, true);
  124. htmltext = event;
  125. }
  126. break;
  127. }
  128. case "32568-02.html":
  129. {
  130. if (st.isCond(5))
  131. {
  132. st.giveItems(JACOBS_NECKLACE, 1);
  133. st.setCond(6, true);
  134. htmltext = event;
  135. }
  136. break;
  137. }
  138. case "30197-02.html":
  139. {
  140. if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION))
  141. {
  142. htmltext = event;
  143. }
  144. break;
  145. }
  146. case "30197-03.html":
  147. {
  148. if (st.isCond(3) && st.hasQuestItems(CROOPS_INTRODUCTION))
  149. {
  150. st.takeItems(CROOPS_INTRODUCTION, -1);
  151. st.setCond(4, true);
  152. htmltext = event;
  153. }
  154. break;
  155. }
  156. case "30191-02.html":
  157. {
  158. if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER))
  159. {
  160. htmltext = event;
  161. }
  162. break;
  163. }
  164. case "reward":
  165. {
  166. if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER))
  167. {
  168. if (player.getLevel() >= MIN_LEVEL)
  169. {
  170. st.addExpAndSp(52518015, 5817677);
  171. st.exitQuest(false, true);
  172. htmltext = "30191-03.html";
  173. }
  174. else
  175. {
  176. htmltext = "level_check.html";
  177. }
  178. }
  179. break;
  180. }
  181. }
  182. return htmltext;
  183. }
  184. @Override
  185. public String onTalk(L2Npc npc, L2PcInstance player)
  186. {
  187. final QuestState st = getQuestState(player, true);
  188. String htmltext = getNoQuestMsg(player);
  189. switch (st.getState())
  190. {
  191. case State.COMPLETED:
  192. {
  193. if (npc.getId() == CROOP)
  194. {
  195. htmltext = "30676-05.html";
  196. }
  197. else if (npc.getId() == UNIDENTIFIED_BODY)
  198. {
  199. htmltext = "32568-04.html";
  200. }
  201. break;
  202. }
  203. case State.CREATED:
  204. {
  205. if (npc.getId() == CROOP)
  206. {
  207. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30676-01.htm" : "30676-04.html";
  208. }
  209. else if (npc.getId() == UNIDENTIFIED_BODY)
  210. {
  211. htmltext = "32568-04.html";
  212. }
  213. break;
  214. }
  215. case State.STARTED:
  216. {
  217. switch (npc.getId())
  218. {
  219. case CROOP:
  220. {
  221. switch (st.getCond())
  222. {
  223. case 1:
  224. {
  225. htmltext = "30676-06.html";
  226. break;
  227. }
  228. case 2:
  229. {
  230. st.giveItems(CROOPS_INTRODUCTION, 1);
  231. st.setCond(3, true);
  232. htmltext = "30676-07.html";
  233. break;
  234. }
  235. case 3:
  236. case 4:
  237. case 5:
  238. {
  239. htmltext = "30676-08.html";
  240. break;
  241. }
  242. case 6:
  243. {
  244. if (st.hasQuestItems(JACOBS_NECKLACE))
  245. {
  246. htmltext = "30676-09.html";
  247. }
  248. break;
  249. }
  250. }
  251. break;
  252. }
  253. case HECTOR:
  254. {
  255. if (st.isCond(3))
  256. {
  257. if (st.hasQuestItems(CROOPS_INTRODUCTION))
  258. {
  259. htmltext = "30197-01.html";
  260. }
  261. }
  262. else if (st.getCond() > 3)
  263. {
  264. htmltext = "30197-04.html";
  265. }
  266. break;
  267. }
  268. case STAN:
  269. {
  270. if (st.isCond(4))
  271. {
  272. htmltext = "30200-01.html";
  273. }
  274. else if (st.getCond() > 4)
  275. {
  276. htmltext = "30200-05.html";
  277. }
  278. break;
  279. }
  280. case UNIDENTIFIED_BODY:
  281. {
  282. if (st.isCond(5))
  283. {
  284. htmltext = "32568-01.html";
  285. }
  286. else if (st.getCond() < 5)
  287. {
  288. htmltext = "32568-03.html";
  289. }
  290. break;
  291. }
  292. case HOLLINT:
  293. {
  294. if (st.isCond(7) && st.hasQuestItems(CROOPS_LETTER))
  295. {
  296. htmltext = "30191-01.html";
  297. }
  298. break;
  299. }
  300. }
  301. break;
  302. }
  303. }
  304. return htmltext;
  305. }
  306. }