Q10292_SevenSignsGirlOfDoubt.java 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.Q10292_SevenSignsGirlOfDoubt;
  20. import quests.Q00198_SevenSignsEmbryo.Q00198_SevenSignsEmbryo;
  21. import com.l2jserver.gameserver.ThreadPoolManager;
  22. import com.l2jserver.gameserver.enums.QuestSound;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.holders.ItemHolder;
  26. import com.l2jserver.gameserver.model.quest.Quest;
  27. import com.l2jserver.gameserver.model.quest.QuestState;
  28. import com.l2jserver.gameserver.util.Util;
  29. /**
  30. * Seven Signs, Girl of Doubt (10292)
  31. * @author Adry_85
  32. */
  33. public final class Q10292_SevenSignsGirlOfDoubt extends Quest
  34. {
  35. // NPCs
  36. private static final int HARDIN = 30832;
  37. private static final int WOOD = 32593;
  38. private static final int FRANZ = 32597;
  39. private static final int JAINA = 32617;
  40. private static final int ELCADIA = 32784;
  41. // Item
  42. private static final ItemHolder ELCADIAS_MARK = new ItemHolder(17226, 10);
  43. // Misc
  44. private static final int MIN_LEVEL = 81;
  45. boolean isBusy = false;
  46. // Monster
  47. private static final int CREATURE_OF_THE_DUSK1 = 27422;
  48. private static final int CREATURE_OF_THE_DUSK2 = 27424;
  49. private static final int[] MOBS =
  50. {
  51. 22801, // Cruel Pincer Golem
  52. 22802, // Cruel Pincer Golem
  53. 22803, // Cruel Pincer Golem
  54. 22804, // Horrifying Jackhammer Golem
  55. 22805, // Horrifying Jackhammer Golem
  56. 22806, // Horrifying Jackhammer Golem
  57. };
  58. public Q10292_SevenSignsGirlOfDoubt()
  59. {
  60. super(10292, Q10292_SevenSignsGirlOfDoubt.class.getSimpleName(), "Seven Signs, Girl of Doubt");
  61. addStartNpc(WOOD);
  62. addTalkId(WOOD, FRANZ, JAINA, ELCADIA, HARDIN);
  63. addKillId(MOBS);
  64. addKillId(CREATURE_OF_THE_DUSK1, CREATURE_OF_THE_DUSK2);
  65. registerQuestItems(ELCADIAS_MARK.getId());
  66. }
  67. @Override
  68. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  69. {
  70. final QuestState st = getQuestState(player, false);
  71. if (st == null)
  72. {
  73. return null;
  74. }
  75. String htmltext = null;
  76. switch (event)
  77. {
  78. case "32593-04.htm":
  79. case "32593-06.htm":
  80. {
  81. htmltext = event;
  82. break;
  83. }
  84. case "32593-05.htm":
  85. {
  86. st.startQuest();
  87. htmltext = event;
  88. break;
  89. }
  90. case "32597-02.html":
  91. case "32597-06.html":
  92. {
  93. htmltext = event;
  94. break;
  95. }
  96. case "32597-07.html":
  97. {
  98. st.setCond(2, true);
  99. htmltext = event;
  100. break;
  101. }
  102. case "32784-02.html":
  103. {
  104. if (st.isCond(2))
  105. {
  106. htmltext = event;
  107. }
  108. break;
  109. }
  110. case "32784-03.html":
  111. {
  112. if (st.isCond(2))
  113. {
  114. st.setCond(3, true);
  115. htmltext = event;
  116. }
  117. break;
  118. }
  119. case "32784-06.html":
  120. {
  121. if (st.isCond(4) && hasItem(player, ELCADIAS_MARK))
  122. {
  123. playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  124. htmltext = event;
  125. }
  126. break;
  127. }
  128. case "32784-08.html":
  129. {
  130. if (st.isCond(4) && hasItem(player, ELCADIAS_MARK))
  131. {
  132. takeItem(player, ELCADIAS_MARK);
  133. st.setCond(5, true);
  134. htmltext = event;
  135. }
  136. break;
  137. }
  138. case "32784-12.html":
  139. case "32784-13.html":
  140. {
  141. if (st.isCond(6))
  142. {
  143. htmltext = event;
  144. }
  145. break;
  146. }
  147. case "32784-14.html":
  148. {
  149. if (st.isCond(6))
  150. {
  151. st.setCond(7, true);
  152. htmltext = event;
  153. }
  154. break;
  155. }
  156. case "SPAWN":
  157. {
  158. if (st.isCond(5))
  159. {
  160. isBusy = true;
  161. final L2Npc creature1 = addSpawn(CREATURE_OF_THE_DUSK1, 89440, -238016, -9632, 335, false, 0, false, player.getInstanceId());
  162. creature1.setIsNoRndWalk(true);
  163. final L2Npc creature2 = addSpawn(CREATURE_OF_THE_DUSK2, 89524, -238131, -9632, 56, false, 0, false, player.getInstanceId());
  164. creature2.setIsNoRndWalk(true);
  165. ThreadPoolManager.getInstance().scheduleGeneral(() ->
  166. {
  167. creature1.deleteMe();
  168. creature2.deleteMe();
  169. st.unset("ex");
  170. isBusy = false;
  171. }, 60000);
  172. }
  173. break;
  174. }
  175. case "30832-02.html":
  176. {
  177. if (st.isCond(7))
  178. {
  179. st.setCond(8, true);
  180. htmltext = event;
  181. }
  182. break;
  183. }
  184. case "30832-03.html":
  185. {
  186. if (st.isCond(8))
  187. {
  188. htmltext = event;
  189. }
  190. break;
  191. }
  192. }
  193. return htmltext;
  194. }
  195. @Override
  196. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  197. {
  198. if (Util.contains(MOBS, npc.getId()))
  199. {
  200. final QuestState st = getRandomPartyMemberState(player, 3, 3, npc);
  201. if ((st != null) && giveItemRandomly(st.getPlayer(), npc, ELCADIAS_MARK.getId(), 1, ELCADIAS_MARK.getCount(), 1.0, true))
  202. {
  203. st.setCond(4, true);
  204. }
  205. }
  206. else
  207. {
  208. final QuestState st = getQuestState(player, false);
  209. if ((st != null) && st.isCond(5))
  210. {
  211. final int value = st.getInt("ex") + 1;
  212. st.set("ex", value);
  213. if (value == 2)
  214. {
  215. st.setCond(6, true);
  216. }
  217. }
  218. }
  219. return super.onKill(npc, player, isSummon);
  220. }
  221. @Override
  222. public String onTalk(L2Npc npc, L2PcInstance player)
  223. {
  224. QuestState st = getQuestState(player, true);
  225. String htmltext = getNoQuestMsg(player);
  226. switch (npc.getId())
  227. {
  228. case WOOD:
  229. {
  230. if (st.isCompleted())
  231. {
  232. htmltext = "32593-02.html";
  233. }
  234. else if (st.isCreated())
  235. {
  236. st = player.getQuestState(Q00198_SevenSignsEmbryo.class.getSimpleName());
  237. htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "32593-01.htm" : "32593-03.htm";
  238. }
  239. else if (st.isStarted())
  240. {
  241. htmltext = "32593-07.html";
  242. }
  243. break;
  244. }
  245. case FRANZ:
  246. {
  247. if (st.isCond(1))
  248. {
  249. htmltext = "32597-01.html";
  250. }
  251. else if (st.isCond(2))
  252. {
  253. htmltext = "32597-03.html";
  254. }
  255. break;
  256. }
  257. case ELCADIA:
  258. {
  259. switch (st.getCond())
  260. {
  261. case 2:
  262. {
  263. htmltext = "32784-01.html";
  264. break;
  265. }
  266. case 3:
  267. {
  268. htmltext = "32784-04.html";
  269. break;
  270. }
  271. case 4:
  272. {
  273. if (hasItem(player, ELCADIAS_MARK))
  274. {
  275. playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  276. htmltext = "32784-05.html";
  277. }
  278. break;
  279. }
  280. case 5:
  281. {
  282. if (isBusy)
  283. {
  284. htmltext = "32784-17.html";
  285. }
  286. else
  287. {
  288. htmltext = "32784-07.html";
  289. }
  290. break;
  291. }
  292. case 6:
  293. {
  294. htmltext = "32784-11.html";
  295. break;
  296. }
  297. case 7:
  298. {
  299. htmltext = "32784-15.html";
  300. break;
  301. }
  302. case 8:
  303. {
  304. if (player.isSubClassActive())
  305. {
  306. htmltext = "32784-18.html";
  307. }
  308. else
  309. {
  310. addExpAndSp(player, 10000000, 1000000);
  311. st.exitQuest(false, true);
  312. htmltext = "32784-16.html";
  313. }
  314. break;
  315. }
  316. }
  317. break;
  318. }
  319. case HARDIN:
  320. {
  321. if (st.isCond(7))
  322. {
  323. htmltext = "30832-01.html";
  324. }
  325. else if (st.isCond(8))
  326. {
  327. htmltext = "30832-04.html";
  328. }
  329. break;
  330. }
  331. }
  332. return htmltext;
  333. }
  334. }