Q00126_TheNameOfEvil2.java 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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.Q00126_TheNameOfEvil2;
  20. import quests.Q00125_TheNameOfEvil1.Q00125_TheNameOfEvil1;
  21. import com.l2jserver.gameserver.enums.QuestSound;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. import com.l2jserver.gameserver.model.quest.State;
  27. import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
  28. /**
  29. * The Name of Evil - 2 (126)
  30. * @author Adry_85
  31. */
  32. public class Q00126_TheNameOfEvil2 extends Quest
  33. {
  34. // NPCs
  35. private static final int SHILENS_STONE_STATUE = 32109;
  36. private static final int MUSHIKA = 32114;
  37. private static final int ASAMAH = 32115;
  38. private static final int ULU_KAIMU = 32119;
  39. private static final int BALU_KAIMU = 32120;
  40. private static final int CHUTA_KAIMU = 32121;
  41. private static final int WARRIORS_GRAVE = 32122;
  42. // Items
  43. private static final int GAZKH_FRAGMENT = 8782;
  44. private static final int BONE_POWDER = 8783;
  45. // Reward
  46. private static final int ENCHANT_WEAPON_A = 729;
  47. public Q00126_TheNameOfEvil2()
  48. {
  49. super(126, Q00126_TheNameOfEvil2.class.getSimpleName(), "The Name of Evil - 2");
  50. addStartNpc(ASAMAH);
  51. addTalkId(ASAMAH, ULU_KAIMU, BALU_KAIMU, CHUTA_KAIMU, WARRIORS_GRAVE, SHILENS_STONE_STATUE, MUSHIKA);
  52. registerQuestItems(GAZKH_FRAGMENT, BONE_POWDER);
  53. }
  54. @Override
  55. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  56. {
  57. QuestState st = getQuestState(player, false);
  58. if (st == null)
  59. {
  60. return getNoQuestMsg(player);
  61. }
  62. switch (event)
  63. {
  64. case "32115-1.html":
  65. st.startQuest();
  66. break;
  67. case "32115-1b.html":
  68. if (st.isCond(1))
  69. {
  70. st.setCond(2, true);
  71. }
  72. break;
  73. case "32119-3.html":
  74. if (st.isCond(2))
  75. {
  76. st.setCond(3, true);
  77. }
  78. break;
  79. case "32119-4.html":
  80. if (st.isCond(3))
  81. {
  82. st.setCond(4, true);
  83. }
  84. break;
  85. case "32119-4a.html":
  86. case "32119-5b.html":
  87. st.playSound(QuestSound.ETCSOUND_ELROKI_SONG_1ST);
  88. break;
  89. case "32119-5.html":
  90. if (st.isCond(4))
  91. {
  92. st.setCond(5, true);
  93. }
  94. break;
  95. case "32120-3.html":
  96. if (st.isCond(5))
  97. {
  98. st.setCond(6, true);
  99. }
  100. break;
  101. case "32120-4.html":
  102. if (st.isCond(6))
  103. {
  104. st.setCond(7, true);
  105. }
  106. break;
  107. case "32120-4a.html":
  108. case "32120-5b.html":
  109. st.playSound(QuestSound.ETCSOUND_ELROKI_SONG_2ND);
  110. break;
  111. case "32120-5.html":
  112. if (st.isCond(7))
  113. {
  114. st.setCond(8, true);
  115. }
  116. break;
  117. case "32121-3.html":
  118. if (st.isCond(8))
  119. {
  120. st.setCond(9, true);
  121. }
  122. break;
  123. case "32121-4.html":
  124. if (st.isCond(9))
  125. {
  126. st.setCond(10, true);
  127. }
  128. break;
  129. case "32121-4a.html":
  130. case "32121-5b.html":
  131. st.playSound(QuestSound.ETCSOUND_ELROKI_SONG_3RD);
  132. break;
  133. case "32121-5.html":
  134. if (st.isCond(10))
  135. {
  136. st.giveItems(GAZKH_FRAGMENT, 1);
  137. st.setCond(11, true);
  138. }
  139. break;
  140. case "32122-2a.html":
  141. npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
  142. break;
  143. case "32122-2d.html":
  144. st.takeItems(GAZKH_FRAGMENT, -1);
  145. break;
  146. case "32122-3.html":
  147. if (st.isCond(12))
  148. {
  149. st.setCond(13, true);
  150. }
  151. break;
  152. case "32122-4.html":
  153. if (st.isCond(13))
  154. {
  155. st.setCond(14, true);
  156. }
  157. break;
  158. case "DO_One":
  159. st.set("DO", "1");
  160. event = "32122-4d.html";
  161. break;
  162. case "MI_One":
  163. st.set("MI", "1");
  164. event = "32122-4f.html";
  165. break;
  166. case "FA_One":
  167. st.set("FA", "1");
  168. event = "32122-4h.html";
  169. break;
  170. case "SOL_One":
  171. st.set("SOL", "1");
  172. event = "32122-4j.html";
  173. break;
  174. case "FA2_One":
  175. st.set("FA2", "1");
  176. if (st.isCond(14) && (st.getInt("DO") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("FA2") > 0))
  177. {
  178. event = "32122-4n.html";
  179. st.setCond(15, true);
  180. }
  181. else
  182. {
  183. event = "32122-4m.html";
  184. }
  185. st.unset("DO");
  186. st.unset("MI");
  187. st.unset("FA");
  188. st.unset("SOL");
  189. st.unset("FA2");
  190. break;
  191. case "32122-4m.html":
  192. st.unset("DO");
  193. st.unset("MI");
  194. st.unset("FA");
  195. st.unset("SOL");
  196. st.unset("FA2");
  197. break;
  198. case "FA_Two":
  199. st.set("FA", "1");
  200. event = "32122-5a.html";
  201. break;
  202. case "SOL_Two":
  203. st.set("SOL", "1");
  204. event = "32122-5c.html";
  205. break;
  206. case "TI_Two":
  207. st.set("TI", "1");
  208. event = "32122-5e.html";
  209. break;
  210. case "SOL2_Two":
  211. st.set("SOL2", "1");
  212. event = "32122-5g.html";
  213. break;
  214. case "FA2_Two":
  215. st.set("FA2", "1");
  216. if (st.isCond(15) && (st.getInt("FA") > 0) && (st.getInt("SOL") > 0) && (st.getInt("TI") > 0) && (st.getInt("SOL2") > 0) && (st.getInt("FA2") > 0))
  217. {
  218. event = "32122-5j.html";
  219. st.setCond(16, true);
  220. }
  221. else
  222. {
  223. event = "32122-5i.html";
  224. }
  225. st.unset("FA");
  226. st.unset("SOL");
  227. st.unset("TI");
  228. st.unset("SOL2");
  229. st.unset("FA2");
  230. break;
  231. case "32122-5i.html":
  232. st.unset("FA");
  233. st.unset("SOL");
  234. st.unset("TI");
  235. st.unset("SOL2");
  236. st.unset("FA2");
  237. break;
  238. case "SOL_Three":
  239. st.set("SOL", "1");
  240. event = "32122-6a.html";
  241. break;
  242. case "FA_Three":
  243. st.set("FA", "1");
  244. event = "32122-6c.html";
  245. break;
  246. case "MI_Three":
  247. st.set("MI", "1");
  248. event = "32122-6e.html";
  249. break;
  250. case "FA2_Three":
  251. st.set("FA2", "1");
  252. event = "32122-6g.html";
  253. break;
  254. case "MI2_Three":
  255. st.set("MI2", "1");
  256. if (st.isCond(16) && (st.getInt("SOL") > 0) && (st.getInt("FA") > 0) && (st.getInt("MI") > 0) && (st.getInt("FA2") > 0) && (st.getInt("MI2") > 0))
  257. {
  258. event = "32122-6j.html";
  259. st.setCond(17, true);
  260. }
  261. else
  262. {
  263. event = "32122-6i.html";
  264. }
  265. st.unset("SOL");
  266. st.unset("FA");
  267. st.unset("MI");
  268. st.unset("FA2");
  269. st.unset("MI2");
  270. break;
  271. case "32122-6i.html":
  272. st.unset("SOL");
  273. st.unset("FA");
  274. st.unset("MI");
  275. st.unset("FA2");
  276. st.unset("MI2");
  277. break;
  278. case "32122-7.html":
  279. st.giveItems(BONE_POWDER, 1);
  280. st.playSound(QuestSound.ETCSOUND_ELROKI_SONG_FULL);
  281. npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
  282. break;
  283. case "32122-8.html":
  284. if (st.isCond(17))
  285. {
  286. st.setCond(18, true);
  287. }
  288. break;
  289. case "32109-2.html":
  290. if (st.isCond(18))
  291. {
  292. st.setCond(19, true);
  293. }
  294. break;
  295. case "32109-3.html":
  296. if (st.isCond(19))
  297. {
  298. st.takeItems(BONE_POWDER, -1);
  299. st.setCond(20, true);
  300. }
  301. break;
  302. case "32115-4.html":
  303. if (st.isCond(20))
  304. {
  305. st.setCond(21, true);
  306. }
  307. break;
  308. case "32115-5.html":
  309. if (st.isCond(21))
  310. {
  311. st.setCond(22, true);
  312. }
  313. break;
  314. case "32114-2.html":
  315. if (st.isCond(22))
  316. {
  317. st.setCond(23, true);
  318. }
  319. break;
  320. case "32114-3.html":
  321. st.rewardItems(ENCHANT_WEAPON_A, 1);
  322. st.giveAdena(460483, true);
  323. st.addExpAndSp(1015973, 102802);
  324. st.exitQuest(false, true);
  325. break;
  326. }
  327. return event;
  328. }
  329. @Override
  330. public String onTalk(L2Npc npc, L2PcInstance player)
  331. {
  332. String htmltext = getNoQuestMsg(player);
  333. QuestState st = getQuestState(player, true);
  334. if (st == null)
  335. {
  336. return htmltext;
  337. }
  338. switch (npc.getId())
  339. {
  340. case ASAMAH:
  341. switch (st.getState())
  342. {
  343. case State.CREATED:
  344. if (player.getLevel() < 77)
  345. {
  346. htmltext = "32115-0.htm";
  347. }
  348. else
  349. {
  350. st = player.getQuestState(Q00125_TheNameOfEvil1.class.getSimpleName());
  351. htmltext = ((st != null) && st.isCompleted()) ? "32115-0a.htm" : "32115-0b.htm";
  352. }
  353. break;
  354. case State.STARTED:
  355. switch (st.getCond())
  356. {
  357. case 1:
  358. htmltext = "32115-1d.html";
  359. break;
  360. case 2:
  361. htmltext = "32115-1c.html";
  362. break;
  363. case 3:
  364. case 4:
  365. case 5:
  366. case 6:
  367. case 7:
  368. case 8:
  369. case 9:
  370. case 10:
  371. case 11:
  372. case 12:
  373. case 13:
  374. case 14:
  375. case 15:
  376. case 16:
  377. case 17:
  378. case 18:
  379. case 19:
  380. htmltext = "32115-2.html";
  381. break;
  382. case 20:
  383. htmltext = "32115-3.html";
  384. break;
  385. case 21:
  386. htmltext = "32115-4j.html";
  387. break;
  388. case 22:
  389. htmltext = "32115-5a.html";
  390. break;
  391. }
  392. break;
  393. case State.COMPLETED:
  394. htmltext = getAlreadyCompletedMsg(player);
  395. break;
  396. }
  397. break;
  398. case ULU_KAIMU:
  399. if (st.isStarted())
  400. {
  401. switch (st.getCond())
  402. {
  403. case 1:
  404. htmltext = "32119-1.html";
  405. break;
  406. case 2:
  407. htmltext = "32119-2.html";
  408. npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
  409. break;
  410. case 3:
  411. htmltext = "32119-3c.html";
  412. break;
  413. case 4:
  414. htmltext = "32119-4c.html";
  415. break;
  416. case 5:
  417. htmltext = "32119-5a.html";
  418. break;
  419. }
  420. }
  421. break;
  422. case BALU_KAIMU:
  423. if (st.isStarted())
  424. {
  425. switch (st.getCond())
  426. {
  427. case 1:
  428. case 2:
  429. case 3:
  430. case 4:
  431. htmltext = "32120-1.html";
  432. break;
  433. case 5:
  434. htmltext = "32120-2.html";
  435. npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
  436. break;
  437. case 6:
  438. htmltext = "32120-3c.html";
  439. break;
  440. case 7:
  441. htmltext = "32120-4c.html";
  442. break;
  443. default:
  444. htmltext = "32120-5a.html";
  445. break;
  446. }
  447. }
  448. break;
  449. case CHUTA_KAIMU:
  450. if (st.isStarted())
  451. {
  452. switch (st.getCond())
  453. {
  454. case 1:
  455. case 2:
  456. case 3:
  457. case 4:
  458. case 5:
  459. case 6:
  460. case 7:
  461. htmltext = "32121-1.html";
  462. break;
  463. case 8:
  464. htmltext = "32121-2.html";
  465. npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
  466. break;
  467. case 9:
  468. htmltext = "32121-3e.html";
  469. break;
  470. case 10:
  471. htmltext = "32121-4e.html";
  472. break;
  473. default:
  474. htmltext = "32121-5a.html";
  475. break;
  476. }
  477. }
  478. break;
  479. case WARRIORS_GRAVE:
  480. if (st.isStarted())
  481. {
  482. switch (st.getCond())
  483. {
  484. case 1:
  485. case 2:
  486. case 3:
  487. case 4:
  488. case 5:
  489. case 6:
  490. case 7:
  491. case 8:
  492. case 9:
  493. case 10:
  494. htmltext = "32122-1.html";
  495. break;
  496. case 11:
  497. htmltext = "32122-2.html";
  498. st.setCond(12, true);
  499. break;
  500. case 12:
  501. htmltext = "32122-2l.html";
  502. break;
  503. case 13:
  504. htmltext = "32122-3b.html";
  505. break;
  506. case 14:
  507. htmltext = "32122-4.html";
  508. st.unset("DO");
  509. st.unset("MI");
  510. st.unset("FA");
  511. st.unset("SOL");
  512. st.unset("FA2");
  513. break;
  514. case 15:
  515. htmltext = "32122-5.html";
  516. st.unset("FA");
  517. st.unset("SOL");
  518. st.unset("TI");
  519. st.unset("SOL2");
  520. st.unset("FA2");
  521. break;
  522. case 16:
  523. htmltext = "32122-6.html";
  524. st.unset("SOL");
  525. st.unset("FA");
  526. st.unset("MI");
  527. st.unset("FA2");
  528. st.unset("MI2");
  529. break;
  530. case 17:
  531. htmltext = st.hasQuestItems(BONE_POWDER) ? "32122-7.html" : "32122-7b.html";
  532. break;
  533. case 18:
  534. htmltext = "32122-8.html";
  535. break;
  536. default:
  537. htmltext = "32122-9.html";
  538. break;
  539. }
  540. }
  541. break;
  542. case SHILENS_STONE_STATUE:
  543. if (st.isStarted())
  544. {
  545. switch (st.getCond())
  546. {
  547. case 1:
  548. case 2:
  549. case 3:
  550. case 4:
  551. case 5:
  552. case 6:
  553. case 7:
  554. case 8:
  555. case 9:
  556. case 10:
  557. case 11:
  558. case 12:
  559. case 13:
  560. case 14:
  561. case 15:
  562. case 16:
  563. case 17:
  564. htmltext = "32109-1a.html";
  565. break;
  566. case 18:
  567. if (st.hasQuestItems(BONE_POWDER))
  568. {
  569. htmltext = "32109-1.html";
  570. }
  571. break;
  572. case 19:
  573. htmltext = "32109-2l.html";
  574. break;
  575. case 20:
  576. htmltext = "32109-5.html";
  577. break;
  578. default:
  579. htmltext = "32109-4.html";
  580. break;
  581. }
  582. }
  583. break;
  584. case MUSHIKA:
  585. if (st.isStarted())
  586. {
  587. if (st.getCond() < 22)
  588. {
  589. htmltext = "32114-4.html";
  590. }
  591. else if (st.isCond(22))
  592. {
  593. htmltext = "32114-1.html";
  594. }
  595. else
  596. {
  597. htmltext = "32114-2.html";
  598. }
  599. }
  600. break;
  601. }
  602. return htmltext;
  603. }
  604. }