Q00115_TheOtherSideOfTruth.java 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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.Q00115_TheOtherSideOfTruth;
  20. import com.l2jserver.gameserver.enums.QuestSound;
  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. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * The Other Side of Truth (115)
  28. * @author Adry_85
  29. */
  30. public class Q00115_TheOtherSideOfTruth extends Quest
  31. {
  32. // NPCs
  33. private static final int MISA = 32018;
  34. private static final int RAFFORTY = 32020;
  35. private static final int ICE_SCULPTURE1 = 32021;
  36. private static final int KIER = 32022;
  37. private static final int ICE_SCULPTURE2 = 32077;
  38. private static final int ICE_SCULPTURE3 = 32078;
  39. private static final int ICE_SCULPTURE4 = 32079;
  40. // Items
  41. private static final int MISAS_LETTER = 8079;
  42. private static final int RAFFORTYS_LETTER = 8080;
  43. private static final int PIECE_OF_TABLET = 8081;
  44. private static final int REPORT_PIECE = 8082;
  45. // Misc
  46. private static final int MIN_LEVEL = 53;
  47. public Q00115_TheOtherSideOfTruth()
  48. {
  49. super(115, Q00115_TheOtherSideOfTruth.class.getSimpleName(), "The Other Side of Truth");
  50. addStartNpc(RAFFORTY);
  51. addTalkId(RAFFORTY, MISA, KIER, ICE_SCULPTURE1, ICE_SCULPTURE2, ICE_SCULPTURE3, ICE_SCULPTURE4);
  52. registerQuestItems(MISAS_LETTER, RAFFORTYS_LETTER, PIECE_OF_TABLET, REPORT_PIECE);
  53. }
  54. @Override
  55. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  56. {
  57. final QuestState st = getQuestState(player, false);
  58. if (st == null)
  59. {
  60. return null;
  61. }
  62. String htmltext = null;
  63. switch (event)
  64. {
  65. case "32020-02.html":
  66. {
  67. st.startQuest();
  68. htmltext = event;
  69. break;
  70. }
  71. case "32020-07.html":
  72. {
  73. if (st.isCond(2))
  74. {
  75. st.takeItems(MISAS_LETTER, -1);
  76. st.setCond(3, true);
  77. htmltext = event;
  78. }
  79. break;
  80. }
  81. case "32020-05.html":
  82. {
  83. if (st.isCond(2))
  84. {
  85. st.takeItems(MISAS_LETTER, -1);
  86. st.exitQuest(true, true);
  87. htmltext = event;
  88. }
  89. break;
  90. }
  91. case "32020-10.html":
  92. {
  93. if (st.isCond(3))
  94. {
  95. st.setCond(4, true);
  96. htmltext = event;
  97. }
  98. break;
  99. }
  100. case "32020-11.html":
  101. {
  102. if (st.isCond(3))
  103. {
  104. st.setCond(4, true);
  105. htmltext = event;
  106. }
  107. break;
  108. }
  109. case "32020-12.html":
  110. {
  111. if (st.isCond(3))
  112. {
  113. st.exitQuest(true, true);
  114. htmltext = event;
  115. }
  116. break;
  117. }
  118. case "32020-08.html":
  119. case "32020-09.html":
  120. case "32020-13.html":
  121. case "32020-14.html":
  122. {
  123. htmltext = event;
  124. break;
  125. }
  126. case "32020-15.html":
  127. {
  128. if (st.isCond(4))
  129. {
  130. st.setCond(5, true);
  131. st.playSound(QuestSound.AMBSOUND_WINGFLAP);
  132. htmltext = event;
  133. }
  134. break;
  135. }
  136. case "32020-23.html":
  137. {
  138. if (st.isCond(9))
  139. {
  140. st.setCond(10, true);
  141. htmltext = event;
  142. }
  143. break;
  144. }
  145. case "finish":
  146. {
  147. if (st.isCond(10))
  148. {
  149. if (st.hasQuestItems(PIECE_OF_TABLET))
  150. {
  151. st.giveAdena(115673, true);
  152. st.addExpAndSp(493595, 40442);
  153. st.exitQuest(false, true);
  154. htmltext = "32020-25.html";
  155. }
  156. else
  157. {
  158. st.setCond(11, true);
  159. htmltext = "32020-26.html";
  160. st.playSound(QuestSound.AMBSOUND_THUNDER);
  161. }
  162. }
  163. break;
  164. }
  165. case "finish2":
  166. {
  167. if (st.isCond(10))
  168. {
  169. if (st.hasQuestItems(PIECE_OF_TABLET))
  170. {
  171. st.giveAdena(115673, true);
  172. st.addExpAndSp(493595, 40442);
  173. st.exitQuest(false, true);
  174. htmltext = "32020-27.html";
  175. }
  176. else
  177. {
  178. st.setCond(11, true);
  179. htmltext = "32020-28.html";
  180. st.playSound(QuestSound.AMBSOUND_THUNDER);
  181. }
  182. }
  183. break;
  184. }
  185. case "32018-05.html":
  186. {
  187. if (st.isCond(6) && (st.hasQuestItems(RAFFORTYS_LETTER)))
  188. {
  189. st.takeItems(RAFFORTYS_LETTER, -1);
  190. st.setCond(7, true);
  191. htmltext = event;
  192. }
  193. break;
  194. }
  195. case "32022-02.html":
  196. {
  197. if (st.isCond(8))
  198. {
  199. st.giveItems(REPORT_PIECE, 1);
  200. st.setCond(9, true);
  201. htmltext = event;
  202. }
  203. break;
  204. }
  205. case "32021-02.html":
  206. {
  207. switch (npc.getId())
  208. {
  209. case ICE_SCULPTURE1:
  210. {
  211. if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1))
  212. {
  213. int ex = st.getInt("ex");
  214. if ((ex == 6) || (ex == 10) || (ex == 12))
  215. {
  216. ex++;
  217. st.set("ex", ex);
  218. st.giveItems(PIECE_OF_TABLET, 1);
  219. htmltext = event;
  220. }
  221. }
  222. break;
  223. }
  224. case ICE_SCULPTURE2:
  225. {
  226. if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1))
  227. {
  228. int ex = st.getInt("ex");
  229. if ((ex == 5) || (ex == 9) || (ex == 12))
  230. {
  231. ex += 2;
  232. st.set("ex", ex);
  233. st.giveItems(PIECE_OF_TABLET, 1);
  234. htmltext = event;
  235. }
  236. }
  237. break;
  238. }
  239. case ICE_SCULPTURE3:
  240. {
  241. if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3))
  242. {
  243. int ex = st.getInt("ex");
  244. if ((ex == 3) || (ex == 9) || (ex == 10))
  245. {
  246. ex += 4;
  247. st.set("ex", ex);
  248. st.giveItems(PIECE_OF_TABLET, 1);
  249. htmltext = event;
  250. }
  251. }
  252. break;
  253. }
  254. case ICE_SCULPTURE4:
  255. {
  256. if (st.isCond(7) && (st.getInt("ex") <= 7))
  257. {
  258. int ex = st.getInt("ex");
  259. if ((ex == 3) || (ex == 5) || (ex == 6))
  260. {
  261. ex += 8;
  262. st.set("ex", ex);
  263. st.giveItems(PIECE_OF_TABLET, 1);
  264. htmltext = event;
  265. }
  266. }
  267. break;
  268. }
  269. }
  270. break;
  271. }
  272. case "32021-03.html":
  273. {
  274. switch (npc.getId())
  275. {
  276. case ICE_SCULPTURE1:
  277. {
  278. if (st.isCond(7) && ((st.getInt("ex") % 2) <= 1))
  279. {
  280. int ex = st.getInt("ex");
  281. if ((ex == 6) || (ex == 10) || (ex == 12))
  282. {
  283. ex++;
  284. st.set("ex", ex);
  285. htmltext = event;
  286. }
  287. }
  288. break;
  289. }
  290. case ICE_SCULPTURE2:
  291. {
  292. if (st.isCond(7) && ((st.getInt("ex") % 4) <= 1))
  293. {
  294. int ex = st.getInt("ex");
  295. if ((ex == 5) || (ex == 9) || (ex == 12))
  296. {
  297. ex += 2;
  298. st.set("ex", ex);
  299. htmltext = event;
  300. }
  301. }
  302. break;
  303. }
  304. case ICE_SCULPTURE3:
  305. {
  306. if (st.isCond(7) && ((st.getInt("ex") % 8) <= 3))
  307. {
  308. int ex = st.getInt("ex");
  309. if ((ex == 3) || (ex == 9) || (ex == 12))
  310. {
  311. ex += 4;
  312. st.set("ex", ex);
  313. htmltext = event;
  314. }
  315. }
  316. break;
  317. }
  318. case ICE_SCULPTURE4:
  319. {
  320. if (st.isCond(7) && (st.getInt("ex") <= 7))
  321. {
  322. int ex = st.getInt("ex");
  323. if ((ex == 3) || (ex == 5) || (ex == 6))
  324. {
  325. ex += 8;
  326. st.set("ex", ex);
  327. htmltext = event;
  328. }
  329. }
  330. break;
  331. }
  332. }
  333. break;
  334. }
  335. case "32021-06.html":
  336. {
  337. switch (npc.getId())
  338. {
  339. case ICE_SCULPTURE1:
  340. {
  341. if (st.isCond(7) && (st.getInt("ex") == 14))
  342. {
  343. st.setCond(8);
  344. htmltext = event;
  345. }
  346. break;
  347. }
  348. case ICE_SCULPTURE2:
  349. {
  350. if (st.isCond(7) && (st.getInt("ex") == 13))
  351. {
  352. st.setCond(8);
  353. htmltext = event;
  354. }
  355. break;
  356. }
  357. case ICE_SCULPTURE3:
  358. {
  359. if (st.isCond(7) && (st.getInt("ex") == 11))
  360. {
  361. st.setCond(8);
  362. htmltext = event;
  363. }
  364. break;
  365. }
  366. case ICE_SCULPTURE4:
  367. {
  368. if (st.isCond(7) && (st.getInt("ex") == 7))
  369. {
  370. st.setCond(8);
  371. htmltext = event;
  372. }
  373. break;
  374. }
  375. }
  376. break;
  377. }
  378. }
  379. return htmltext;
  380. }
  381. @Override
  382. public String onTalk(L2Npc npc, L2PcInstance player)
  383. {
  384. final QuestState st = getQuestState(player, true);
  385. String htmltext = getNoQuestMsg(player);
  386. if (st == null)
  387. {
  388. return htmltext;
  389. }
  390. switch (st.getState())
  391. {
  392. case State.COMPLETED:
  393. {
  394. if (npc.getId() == RAFFORTY)
  395. {
  396. htmltext = getAlreadyCompletedMsg(player);
  397. }
  398. break;
  399. }
  400. case State.CREATED:
  401. {
  402. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-01.htm" : "32020-03.html";
  403. break;
  404. }
  405. case State.STARTED:
  406. {
  407. switch (npc.getId())
  408. {
  409. case RAFFORTY:
  410. {
  411. switch (st.getCond())
  412. {
  413. case 1:
  414. {
  415. htmltext = "32020-04.html";
  416. break;
  417. }
  418. case 2:
  419. {
  420. htmltext = (!st.hasQuestItems(MISAS_LETTER)) ? "32020-05.html" : "32020-06.html";
  421. break;
  422. }
  423. case 3:
  424. {
  425. htmltext = "32020-16.html";
  426. break;
  427. }
  428. case 4:
  429. {
  430. htmltext = "32020-17.html";
  431. break;
  432. }
  433. case 5:
  434. {
  435. st.giveItems(RAFFORTYS_LETTER, 1);
  436. st.setCond(6, true);
  437. htmltext = "32020-18.html";
  438. break;
  439. }
  440. case 6:
  441. {
  442. if (st.hasQuestItems(RAFFORTYS_LETTER))
  443. {
  444. htmltext = "32020-19.html";
  445. }
  446. else
  447. {
  448. st.giveItems(RAFFORTYS_LETTER, 1);
  449. htmltext = "32020-20.html";
  450. }
  451. break;
  452. }
  453. case 7:
  454. case 8:
  455. {
  456. htmltext = "32020-21.html";
  457. break;
  458. }
  459. case 9:
  460. {
  461. if (st.hasQuestItems(REPORT_PIECE))
  462. {
  463. htmltext = "32020-22.html";
  464. }
  465. break;
  466. }
  467. case 10:
  468. {
  469. htmltext = "32020-24.html";
  470. break;
  471. }
  472. case 11:
  473. {
  474. if (!st.hasQuestItems(PIECE_OF_TABLET))
  475. {
  476. htmltext = "32020-29.html";
  477. }
  478. else
  479. {
  480. st.giveAdena(115673, true);
  481. st.addExpAndSp(493595, 40442);
  482. st.exitQuest(false, true);
  483. htmltext = "32020-30.html";
  484. }
  485. break;
  486. }
  487. }
  488. break;
  489. }
  490. case MISA:
  491. {
  492. switch (st.getCond())
  493. {
  494. case 1:
  495. {
  496. st.giveItems(MISAS_LETTER, 1);
  497. st.setCond(2, true);
  498. htmltext = "32018-01.html";
  499. break;
  500. }
  501. case 2:
  502. {
  503. htmltext = "32018-02.html";
  504. break;
  505. }
  506. case 3:
  507. case 4:
  508. {
  509. htmltext = "32018-03.html";
  510. break;
  511. }
  512. case 5:
  513. {
  514. break;
  515. }
  516. case 6:
  517. {
  518. if (st.hasQuestItems(RAFFORTYS_LETTER))
  519. {
  520. htmltext = "32018-04.html";
  521. }
  522. break;
  523. }
  524. case 7:
  525. {
  526. htmltext = "32018-06.html";
  527. break;
  528. }
  529. }
  530. break;
  531. }
  532. case KIER:
  533. {
  534. switch (st.getCond())
  535. {
  536. case 8:
  537. {
  538. htmltext = "32022-01.html";
  539. break;
  540. }
  541. case 9:
  542. {
  543. if (st.hasQuestItems(REPORT_PIECE))
  544. {
  545. htmltext = "32022-03.html";
  546. }
  547. else
  548. {
  549. st.giveItems(REPORT_PIECE, 1);
  550. htmltext = "32022-04.html";
  551. }
  552. break;
  553. }
  554. case 11:
  555. {
  556. if (!st.hasQuestItems(REPORT_PIECE))
  557. {
  558. htmltext = "32022-05.html";
  559. }
  560. break;
  561. }
  562. }
  563. break;
  564. }
  565. case ICE_SCULPTURE1:
  566. {
  567. switch (st.getCond())
  568. {
  569. case 7:
  570. {
  571. if ((st.getInt("ex") % 2) <= 1)
  572. {
  573. int ex = st.getInt("ex");
  574. if ((ex == 6) || (ex == 10) || (ex == 12))
  575. {
  576. htmltext = "32021-01.html";
  577. }
  578. else if (ex == 14)
  579. {
  580. htmltext = "32021-05.html";
  581. }
  582. else
  583. {
  584. ex++;
  585. st.set("ex", ex);
  586. htmltext = "32021-07.html";
  587. }
  588. }
  589. else
  590. {
  591. htmltext = "32021-04.html";
  592. }
  593. break;
  594. }
  595. case 8:
  596. {
  597. htmltext = "32021-08.html";
  598. break;
  599. }
  600. case 11:
  601. {
  602. if (!st.hasQuestItems(PIECE_OF_TABLET))
  603. {
  604. st.giveItems(PIECE_OF_TABLET, 1);
  605. htmltext = "32021-09.html";
  606. }
  607. else
  608. {
  609. htmltext = "32021-10.html";
  610. }
  611. break;
  612. }
  613. }
  614. break;
  615. }
  616. case ICE_SCULPTURE2:
  617. {
  618. switch (st.getCond())
  619. {
  620. case 7:
  621. {
  622. if ((st.getInt("ex") % 4) <= 1)
  623. {
  624. int ex = st.getInt("ex");
  625. if ((ex == 5) || (ex == 9) || (ex == 12))
  626. {
  627. htmltext = "32021-01.html";
  628. }
  629. else if (ex == 13)
  630. {
  631. htmltext = "32021-05.html";
  632. }
  633. else
  634. {
  635. ex += 2;
  636. st.set("ex", ex);
  637. htmltext = "32021-07.html";
  638. }
  639. }
  640. else
  641. {
  642. htmltext = "32021-04.html";
  643. }
  644. break;
  645. }
  646. case 8:
  647. {
  648. htmltext = "32021-08.html";
  649. break;
  650. }
  651. case 11:
  652. {
  653. if (!st.hasQuestItems(PIECE_OF_TABLET))
  654. {
  655. st.giveItems(PIECE_OF_TABLET, 1);
  656. htmltext = "32021-09.html";
  657. }
  658. else
  659. {
  660. htmltext = "32021-10.html";
  661. }
  662. break;
  663. }
  664. }
  665. break;
  666. }
  667. case ICE_SCULPTURE3:
  668. {
  669. switch (st.getCond())
  670. {
  671. case 7:
  672. {
  673. if ((st.getInt("ex") % 8) <= 3)
  674. {
  675. int ex = st.getInt("ex");
  676. if ((ex == 3) || (ex == 9) || (ex == 10))
  677. {
  678. htmltext = "32021-01.html";
  679. }
  680. else if (ex == 11)
  681. {
  682. htmltext = "32021-05.html";
  683. }
  684. else
  685. {
  686. ex += 4;
  687. st.set("ex", ex);
  688. htmltext = "32021-07.html";
  689. }
  690. }
  691. else
  692. {
  693. htmltext = "32021-04.html";
  694. }
  695. break;
  696. }
  697. case 8:
  698. {
  699. htmltext = "32021-08.html";
  700. break;
  701. }
  702. case 11:
  703. {
  704. if (!st.hasQuestItems(PIECE_OF_TABLET))
  705. {
  706. st.giveItems(PIECE_OF_TABLET, 1);
  707. htmltext = "32021-09.html";
  708. }
  709. else
  710. {
  711. htmltext = "32021-10.html";
  712. }
  713. break;
  714. }
  715. }
  716. break;
  717. }
  718. case ICE_SCULPTURE4:
  719. {
  720. switch (st.getCond())
  721. {
  722. case 7:
  723. {
  724. if (st.getInt("ex") <= 7)
  725. {
  726. int ex = st.getInt("ex");
  727. if ((ex == 3) || (ex == 5) || (ex == 6))
  728. {
  729. htmltext = "32021-01.html";
  730. }
  731. else if (ex == 7)
  732. {
  733. htmltext = "32021-05.html";
  734. }
  735. else
  736. {
  737. ex += 8;
  738. st.set("ex", ex);
  739. htmltext = "32021-07.html";
  740. }
  741. }
  742. else
  743. {
  744. htmltext = "32021-04.html";
  745. }
  746. break;
  747. }
  748. case 8:
  749. {
  750. htmltext = "32021-08.html";
  751. break;
  752. }
  753. case 11:
  754. {
  755. if (!st.hasQuestItems(PIECE_OF_TABLET))
  756. {
  757. st.giveItems(PIECE_OF_TABLET, 1);
  758. htmltext = "32021-09.html";
  759. }
  760. else
  761. {
  762. htmltext = "32021-10.html";
  763. }
  764. break;
  765. }
  766. }
  767. break;
  768. }
  769. }
  770. break;
  771. }
  772. }
  773. return htmltext;
  774. }
  775. }