Q00066_CertifiedArbalester.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
  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.Q00066_CertifiedArbalester;
  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.base.ClassId;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. import com.l2jserver.gameserver.network.serverpackets.SocialAction;
  27. import com.l2jserver.gameserver.util.Util;
  28. /**
  29. * Certified Arbalester (66)
  30. * @author ivantotov
  31. */
  32. public final class Q00066_CertifiedArbalester extends Quest
  33. {
  34. // NPCs
  35. private static final int WAREHOUSE_KEEPER_HOLVAS = 30058;
  36. private static final int MAGISTER_GAIUS = 30171;
  37. private static final int BLACKSMITH_POITAN = 30458;
  38. private static final int MAGISTER_CLAYTON = 30464;
  39. private static final int MAGISTER_GAUEN = 30717;
  40. private static final int MAGISTER_KAIENA = 30720;
  41. private static final int MASTER_RINDY = 32201;
  42. private static final int GRAND_MASTER_MELDINA = 32214;
  43. private static final int MASTER_SELSIA = 32220;
  44. // Items
  45. private static final int ENMITY_CRYSTAL = 9773;
  46. private static final int ENMITY_CRYSTAL_CORE = 9774;
  47. private static final int MANUSCRIPT_PAGE = 9775;
  48. private static final int ENCODED_PAGE_ON_THE_ANCIENT_RACE = 9776;
  49. private static final int KAMAEL_INQUISITOR_TRAINEE_MARK = 9777;
  50. private static final int FRAGMENT_OF_ATTACK_ORDERS = 9778;
  51. private static final int GRANDIS_ATTACK_ORDERS = 9779;
  52. private static final int MANASHENS_TALISMAN = 9780;
  53. private static final int RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE = 9781;
  54. // Reward
  55. private static final int DIMENSIONAL_DIAMOND = 7562;
  56. private static final int KAMAEL_INQUISITOR_MARK = 9782;
  57. // Monster
  58. private static final int GRANITIC_GOLEM = 20083;
  59. private static final int HANGMAN_TREE = 20144;
  60. private static final int AMBER_BASILISK = 20199;
  61. private static final int STRAIN = 20200;
  62. private static final int GHOUL = 20201;
  63. private static final int DEAD_SEEKER = 20202;
  64. private static final int GRANDIS = 20554;
  65. private static final int MANASHEN_GARGOYLE = 20563;
  66. private static final int TIMAK_ORC = 20583;
  67. private static final int TIMAK_ORC_ARCHER = 20584;
  68. private static final int DELU_LIZARDMAN_SHAMAN = 20781;
  69. private static final int WATCHMAN_OF_THE_PLAINS = 21102;
  70. private static final int ROUGHLY_HEWN_ROCK_GOLEM = 21103;
  71. private static final int DELU_LIZARDMAN_SUPPLIER = 21104;
  72. private static final int DELU_LIZARDMAN_AGENT = 21105;
  73. private static final int CURSED_SEER = 21106;
  74. private static final int DELU_LIZARDMAN_COMMANDER = 21107;
  75. // Quest Monster
  76. private static final int CRIMSON_LADY = 27336;
  77. // Misc
  78. private static final int MIN_LEVEL = 39;
  79. public Q00066_CertifiedArbalester()
  80. {
  81. super(66, Q00066_CertifiedArbalester.class.getSimpleName(), "Certified Arbalester");
  82. addStartNpc(MASTER_RINDY);
  83. addTalkId(MASTER_RINDY, WAREHOUSE_KEEPER_HOLVAS, MAGISTER_GAIUS, BLACKSMITH_POITAN, MAGISTER_CLAYTON, MAGISTER_GAUEN, MAGISTER_KAIENA, GRAND_MASTER_MELDINA, MASTER_SELSIA);
  84. addKillId(GRANITIC_GOLEM, HANGMAN_TREE, AMBER_BASILISK, STRAIN, GHOUL, DEAD_SEEKER, GRANDIS, MANASHEN_GARGOYLE, TIMAK_ORC, TIMAK_ORC_ARCHER, DELU_LIZARDMAN_SHAMAN, WATCHMAN_OF_THE_PLAINS, ROUGHLY_HEWN_ROCK_GOLEM, DELU_LIZARDMAN_SUPPLIER, DELU_LIZARDMAN_AGENT, CURSED_SEER, DELU_LIZARDMAN_COMMANDER, CRIMSON_LADY);
  85. registerQuestItems(ENMITY_CRYSTAL, ENMITY_CRYSTAL_CORE, MANUSCRIPT_PAGE, ENCODED_PAGE_ON_THE_ANCIENT_RACE, KAMAEL_INQUISITOR_TRAINEE_MARK, FRAGMENT_OF_ATTACK_ORDERS, GRANDIS_ATTACK_ORDERS, MANASHENS_TALISMAN, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE);
  86. }
  87. @Override
  88. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  89. {
  90. final QuestState qs = getQuestState(player, false);
  91. if (qs == null)
  92. {
  93. return null;
  94. }
  95. String htmltext = null;
  96. switch (event)
  97. {
  98. case "ACCEPT":
  99. {
  100. if ((player.getLevel() >= MIN_LEVEL) && (player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK))
  101. {
  102. qs.startQuest();
  103. qs.setMemoState(1);
  104. if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0)
  105. {
  106. giveItems(player, DIMENSIONAL_DIAMOND, 64);
  107. player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
  108. htmltext = "32201-07a.htm";
  109. }
  110. else
  111. {
  112. htmltext = "32201-07.htm";
  113. }
  114. }
  115. break;
  116. }
  117. case "32201-08.html":
  118. {
  119. if (qs.isMemoState(1))
  120. {
  121. qs.setMemoState(2);
  122. qs.setCond(2, true);
  123. htmltext = event;
  124. }
  125. break;
  126. }
  127. case "30058-03.html":
  128. case "30058-04.html":
  129. {
  130. if (qs.isMemoState(7))
  131. {
  132. htmltext = event;
  133. }
  134. break;
  135. }
  136. case "30058-05.html":
  137. {
  138. if (qs.isMemoState(7))
  139. {
  140. qs.setMemoState(8);
  141. qs.setCond(7, true);
  142. htmltext = event;
  143. }
  144. break;
  145. }
  146. case "30058-08.html":
  147. {
  148. if (qs.isMemoState(9))
  149. {
  150. giveItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1);
  151. qs.setMemoState(10);
  152. qs.setCond(9, true);
  153. htmltext = event;
  154. }
  155. break;
  156. }
  157. case "30171-03.html":
  158. {
  159. if (qs.isMemoState(23))
  160. {
  161. htmltext = event;
  162. }
  163. break;
  164. }
  165. case "30171-05.html":
  166. {
  167. if (qs.isMemoState(23))
  168. {
  169. takeItems(player, GRANDIS_ATTACK_ORDERS, -1);
  170. qs.setMemoState(24);
  171. htmltext = event;
  172. }
  173. break;
  174. }
  175. case "30171-06.html":
  176. case "30171-07.html":
  177. {
  178. if (qs.isMemoState(24))
  179. {
  180. htmltext = event;
  181. }
  182. break;
  183. }
  184. case "30171-08.html":
  185. {
  186. if (qs.isMemoState(24))
  187. {
  188. qs.setMemoState(25);
  189. }
  190. qs.setCond(14, true);
  191. htmltext = event;
  192. break;
  193. }
  194. case "30458-03.html":
  195. {
  196. if (qs.isMemoState(5))
  197. {
  198. takeItems(player, ENMITY_CRYSTAL_CORE, 1);
  199. qs.setMemoState(6);
  200. htmltext = event;
  201. }
  202. break;
  203. }
  204. case "30458-05.html":
  205. case "30458-06.html":
  206. case "30458-07.html":
  207. case "30458-08.html":
  208. {
  209. if (qs.isMemoState(6))
  210. {
  211. htmltext = event;
  212. }
  213. break;
  214. }
  215. case "30458-09.html":
  216. {
  217. if (qs.isMemoState(6))
  218. {
  219. qs.setMemoState(7);
  220. qs.setCond(6, true);
  221. htmltext = event;
  222. }
  223. break;
  224. }
  225. case "30464-03.html":
  226. case "30464-04.html":
  227. case "30464-05.html":
  228. {
  229. if (qs.isMemoState(2))
  230. {
  231. htmltext = event;
  232. }
  233. break;
  234. }
  235. case "30464-06.html":
  236. {
  237. if (qs.isMemoState(2))
  238. {
  239. qs.setMemoState(3);
  240. qs.setCond(3, true);
  241. htmltext = event;
  242. }
  243. break;
  244. }
  245. case "30464-09.html":
  246. {
  247. if (qs.isMemoState(4))
  248. {
  249. giveItems(player, ENMITY_CRYSTAL_CORE, 1);
  250. qs.setMemoState(5);
  251. qs.setCond(5, true);
  252. htmltext = event;
  253. }
  254. break;
  255. }
  256. case "30464-11.html":
  257. {
  258. htmltext = event;
  259. break;
  260. }
  261. case "30717-03.html":
  262. case "30717-05.html":
  263. case "30717-06.html":
  264. case "30717-07.html":
  265. case "30717-08.html":
  266. {
  267. if (qs.isMemoState(28))
  268. {
  269. htmltext = event;
  270. }
  271. break;
  272. }
  273. case "30717-09.html":
  274. {
  275. if (qs.isMemoState(28))
  276. {
  277. qs.setMemoState(29);
  278. qs.setCond(17, true);
  279. htmltext = event;
  280. }
  281. break;
  282. }
  283. case "30720-03.html":
  284. {
  285. if (qs.isMemoState(29))
  286. {
  287. htmltext = event;
  288. }
  289. break;
  290. }
  291. case "30720-04.html":
  292. {
  293. if (qs.isMemoState(29))
  294. {
  295. qs.setMemoState(30);
  296. qs.setCond(18, true);
  297. htmltext = event;
  298. }
  299. break;
  300. }
  301. case "32214-03.html":
  302. {
  303. if (qs.isMemoState(10))
  304. {
  305. htmltext = event;
  306. }
  307. break;
  308. }
  309. case "32214-04.html":
  310. {
  311. if (qs.isMemoState(10))
  312. {
  313. takeItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1);
  314. giveItems(player, KAMAEL_INQUISITOR_TRAINEE_MARK, 1);
  315. qs.setMemoState(11);
  316. qs.setCond(10, true);
  317. htmltext = event;
  318. }
  319. break;
  320. }
  321. case "32220-03.html":
  322. {
  323. if (qs.isMemoState(11))
  324. {
  325. takeItems(player, KAMAEL_INQUISITOR_TRAINEE_MARK, -1);
  326. qs.setMemoState(12);
  327. htmltext = event;
  328. }
  329. break;
  330. }
  331. case "32220-05.html":
  332. {
  333. if (qs.isMemoState(12))
  334. {
  335. qs.setMemoState(13);
  336. htmltext = event;
  337. }
  338. break;
  339. }
  340. case "32220-06.html":
  341. {
  342. if (qs.isMemoState(13))
  343. {
  344. qs.setMemoStateEx(1, 0);
  345. htmltext = event;
  346. }
  347. break;
  348. }
  349. case "32220-09.html":
  350. case "32220-10.html":
  351. {
  352. if (qs.isMemoState(13))
  353. {
  354. htmltext = event;
  355. }
  356. break;
  357. }
  358. case "32220-11.html":
  359. case "32220-12.html":
  360. case "32220-13.html":
  361. {
  362. if (qs.isMemoState(13))
  363. {
  364. qs.setMemoState(13);
  365. qs.setMemoStateEx(1, 1);
  366. htmltext = event;
  367. }
  368. break;
  369. }
  370. case "32220-13a.html":
  371. {
  372. if (qs.isMemoState(13))
  373. {
  374. qs.setMemoState(20);
  375. qs.setMemoStateEx(1, 0);
  376. htmltext = event;
  377. }
  378. break;
  379. }
  380. case "32220-13b.html":
  381. {
  382. if (qs.isMemoState(20))
  383. {
  384. qs.setMemoState(21);
  385. qs.setCond(11, true);
  386. htmltext = event;
  387. }
  388. break;
  389. }
  390. case "32220-19.html":
  391. case "32220-21.html":
  392. case "32220-22.html":
  393. case "32220-23.html":
  394. case "32220-24.html":
  395. case "32220-25.html":
  396. {
  397. if (qs.isMemoState(31))
  398. {
  399. htmltext = event;
  400. }
  401. break;
  402. }
  403. case "32220-26.html":
  404. {
  405. if (qs.isMemoState(31))
  406. {
  407. qs.setMemoStateEx(1, 0);
  408. qs.setMemoState(32);
  409. qs.setCond(19, true);
  410. htmltext = event;
  411. }
  412. break;
  413. }
  414. }
  415. return htmltext;
  416. }
  417. @Override
  418. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  419. {
  420. final QuestState qs = getQuestState(killer, false);
  421. if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true))
  422. {
  423. switch (npc.getId())
  424. {
  425. case GRANITIC_GOLEM:
  426. case HANGMAN_TREE:
  427. {
  428. if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30))
  429. {
  430. if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29)
  431. {
  432. qs.setCond(8, true);
  433. }
  434. else
  435. {
  436. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  437. }
  438. giveItems(killer, MANUSCRIPT_PAGE, 1);
  439. if ((getRandom(1000) < 100) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29))
  440. {
  441. giveItems(killer, MANUSCRIPT_PAGE, 1);
  442. }
  443. }
  444. break;
  445. }
  446. case AMBER_BASILISK:
  447. {
  448. if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30))
  449. {
  450. if (getRandom(1000) < 980)
  451. {
  452. if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29)
  453. {
  454. qs.setCond(8, true);
  455. }
  456. else
  457. {
  458. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  459. }
  460. giveItems(killer, MANUSCRIPT_PAGE, 1);
  461. }
  462. }
  463. break;
  464. }
  465. case STRAIN:
  466. {
  467. if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30))
  468. {
  469. if (getRandom(1000) < 860)
  470. {
  471. if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29)
  472. {
  473. qs.setCond(8, true);
  474. }
  475. else
  476. {
  477. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  478. }
  479. giveItems(killer, MANUSCRIPT_PAGE, 1);
  480. }
  481. }
  482. break;
  483. }
  484. case GHOUL:
  485. case DEAD_SEEKER:
  486. {
  487. if (qs.isMemoState(8) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 30))
  488. {
  489. if (getQuestItemsCount(killer, MANUSCRIPT_PAGE) >= 29)
  490. {
  491. qs.setCond(8, true);
  492. }
  493. else
  494. {
  495. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  496. }
  497. giveItems(killer, MANUSCRIPT_PAGE, 1);
  498. if ((getRandom(1000) < 20) && (getQuestItemsCount(killer, MANUSCRIPT_PAGE) < 29))
  499. {
  500. giveItems(killer, MANUSCRIPT_PAGE, 1);
  501. }
  502. }
  503. break;
  504. }
  505. case GRANDIS:
  506. {
  507. if (qs.isMemoState(21) || (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) < 10)))
  508. {
  509. if (getRandom(1000) < 780)
  510. {
  511. if (qs.isMemoState(21) && !hasQuestItems(killer, FRAGMENT_OF_ATTACK_ORDERS))
  512. {
  513. qs.setMemoState(22);
  514. qs.setCond(12, true);
  515. giveItems(killer, FRAGMENT_OF_ATTACK_ORDERS, 1);
  516. }
  517. else if (qs.isMemoState(22) && (getQuestItemsCount(killer, FRAGMENT_OF_ATTACK_ORDERS) >= 9))
  518. {
  519. qs.setMemoState(23);
  520. qs.setCond(13, true);
  521. takeItems(killer, FRAGMENT_OF_ATTACK_ORDERS, -1);
  522. giveItems(killer, GRANDIS_ATTACK_ORDERS, 1);
  523. }
  524. else
  525. {
  526. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  527. giveItems(killer, FRAGMENT_OF_ATTACK_ORDERS, 1);
  528. }
  529. }
  530. break;
  531. }
  532. }
  533. case MANASHEN_GARGOYLE:
  534. {
  535. if (qs.isMemoState(25) || (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) < 10)))
  536. {
  537. if (getRandom(1000) < 840)
  538. {
  539. if (qs.isMemoState(25) && !hasQuestItems(killer, MANASHENS_TALISMAN))
  540. {
  541. qs.setMemoState(26);
  542. qs.setCond(15, true);
  543. }
  544. else if (qs.isMemoState(26) && (getQuestItemsCount(killer, MANASHENS_TALISMAN) >= 9))
  545. {
  546. qs.setMemoState(27);
  547. qs.setCond(16, true);
  548. }
  549. else
  550. {
  551. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  552. }
  553. giveItems(killer, MANASHENS_TALISMAN, 1);
  554. }
  555. break;
  556. }
  557. }
  558. case TIMAK_ORC:
  559. case TIMAK_ORC_ARCHER:
  560. {
  561. if (qs.isMemoState(32))
  562. {
  563. final int i4 = qs.getMemoStateEx(1);
  564. if (i4 < 5)
  565. {
  566. qs.setMemoStateEx(1, i4 + 1);
  567. }
  568. else if (i4 >= 4)
  569. {
  570. qs.setMemoStateEx(1, 0);
  571. addSpawn(CRIMSON_LADY, npc, true, 0, false);
  572. }
  573. }
  574. break;
  575. }
  576. case DELU_LIZARDMAN_SHAMAN:
  577. case DELU_LIZARDMAN_SUPPLIER:
  578. {
  579. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  580. {
  581. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29)
  582. {
  583. qs.setCond(4, true);
  584. }
  585. else
  586. {
  587. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  588. }
  589. giveItems(killer, ENMITY_CRYSTAL, 1);
  590. if ((getRandom(1000) < 80) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29))
  591. {
  592. giveItems(killer, ENMITY_CRYSTAL, 1);
  593. }
  594. }
  595. break;
  596. }
  597. case WATCHMAN_OF_THE_PLAINS:
  598. {
  599. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  600. {
  601. if (getRandom(1000) < 840)
  602. {
  603. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29)
  604. {
  605. qs.setCond(4, true);
  606. }
  607. else
  608. {
  609. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  610. }
  611. giveItems(killer, ENMITY_CRYSTAL, 1);
  612. }
  613. }
  614. break;
  615. }
  616. case ROUGHLY_HEWN_ROCK_GOLEM:
  617. {
  618. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  619. {
  620. if (getRandom(1000) < 860)
  621. {
  622. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29)
  623. {
  624. qs.setCond(4, true);
  625. }
  626. else
  627. {
  628. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  629. }
  630. giveItems(killer, ENMITY_CRYSTAL, 1);
  631. }
  632. }
  633. break;
  634. }
  635. case DELU_LIZARDMAN_AGENT:
  636. {
  637. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  638. {
  639. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29)
  640. {
  641. qs.setCond(4, true);
  642. }
  643. else
  644. {
  645. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  646. }
  647. giveItems(killer, ENMITY_CRYSTAL, 1);
  648. if ((getRandom(1000) < 240) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29))
  649. {
  650. giveItems(killer, ENMITY_CRYSTAL, 1);
  651. }
  652. }
  653. break;
  654. }
  655. case CURSED_SEER:
  656. {
  657. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  658. {
  659. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 29)
  660. {
  661. qs.setCond(4, true);
  662. }
  663. else
  664. {
  665. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  666. }
  667. giveItems(killer, ENMITY_CRYSTAL, 1);
  668. if ((getRandom(1000) < 40) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29))
  669. {
  670. giveItems(killer, ENMITY_CRYSTAL, 1);
  671. }
  672. }
  673. break;
  674. }
  675. case DELU_LIZARDMAN_COMMANDER:
  676. {
  677. if (qs.isMemoState(3) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 30))
  678. {
  679. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 28)
  680. {
  681. qs.setCond(4, true);
  682. }
  683. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 29)
  684. {
  685. giveItems(killer, ENMITY_CRYSTAL, 2);
  686. if ((getRandom(1000) < 220) && (getQuestItemsCount(killer, ENMITY_CRYSTAL) < 28))
  687. {
  688. giveItems(killer, ENMITY_CRYSTAL, 1);
  689. if (getQuestItemsCount(killer, ENMITY_CRYSTAL) >= 27)
  690. {
  691. qs.setCond(4, true);
  692. }
  693. else
  694. {
  695. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  696. }
  697. }
  698. }
  699. else
  700. {
  701. giveItems(killer, ENMITY_CRYSTAL, 1);
  702. }
  703. }
  704. break;
  705. }
  706. case CRIMSON_LADY:
  707. {
  708. if (qs.isMemoState(32))
  709. {
  710. giveItems(killer, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE, 1);
  711. qs.setMemoState(32);
  712. qs.setCond(20, true);
  713. }
  714. break;
  715. }
  716. }
  717. }
  718. return super.onKill(npc, killer, isSummon);
  719. }
  720. @Override
  721. public String onTalk(L2Npc npc, L2PcInstance player)
  722. {
  723. final QuestState qs = getQuestState(player, true);
  724. final int memoState = qs.getMemoState();
  725. String htmltext = getNoQuestMsg(player);
  726. if (qs.isCreated())
  727. {
  728. if (npc.getId() == MASTER_RINDY)
  729. {
  730. if ((player.getClassId() == ClassId.warder) && !hasQuestItems(player, KAMAEL_INQUISITOR_MARK))
  731. {
  732. if (player.getLevel() >= MIN_LEVEL)
  733. {
  734. htmltext = "32201-01.htm";
  735. }
  736. else
  737. {
  738. htmltext = "32201-02.html";
  739. }
  740. }
  741. else
  742. {
  743. htmltext = "32201-03.html";
  744. }
  745. }
  746. }
  747. else if (qs.isStarted())
  748. {
  749. switch (npc.getId())
  750. {
  751. case MASTER_RINDY:
  752. {
  753. if (memoState == 1)
  754. {
  755. qs.setMemoState(2);
  756. qs.setCond(2, true);
  757. htmltext = "32201-09.html";
  758. }
  759. else if (memoState == 2)
  760. {
  761. htmltext = "32201-10.html";
  762. }
  763. else if ((memoState > 2) && (memoState < 11))
  764. {
  765. htmltext = "32201-11.html";
  766. }
  767. else if (memoState >= 11)
  768. {
  769. htmltext = "32201-12.html";
  770. }
  771. break;
  772. }
  773. case WAREHOUSE_KEEPER_HOLVAS:
  774. {
  775. if (memoState < 7)
  776. {
  777. htmltext = "30058-01.html";
  778. }
  779. else if (memoState == 7)
  780. {
  781. htmltext = "30058-02.html";
  782. }
  783. else if (memoState == 8)
  784. {
  785. if (getQuestItemsCount(player, MANUSCRIPT_PAGE) < 30)
  786. {
  787. htmltext = "30058-06.html";
  788. }
  789. else
  790. {
  791. takeItems(player, MANUSCRIPT_PAGE, -1);
  792. qs.setMemoState(9);
  793. htmltext = "30058-07.html";
  794. }
  795. }
  796. else if (memoState == 9)
  797. {
  798. giveItems(player, ENCODED_PAGE_ON_THE_ANCIENT_RACE, 1);
  799. qs.setMemoState(10);
  800. qs.setCond(9, true);
  801. htmltext = "30058-09.html";
  802. }
  803. else if (memoState > 9)
  804. {
  805. htmltext = "30058-10.html";
  806. }
  807. break;
  808. }
  809. case MAGISTER_GAIUS:
  810. {
  811. if (memoState < 23)
  812. {
  813. htmltext = "30171-01.html";
  814. }
  815. else if (memoState == 23)
  816. {
  817. htmltext = "30171-02.html";
  818. }
  819. else if (memoState == 24)
  820. {
  821. htmltext = "30171-06.html";
  822. }
  823. else if (memoState == 25)
  824. {
  825. htmltext = "30171-09.html";
  826. }
  827. else if (memoState == 26)
  828. {
  829. htmltext = "30171-10.html";
  830. }
  831. else if (memoState == 27)
  832. {
  833. htmltext = "30171-11.html";
  834. }
  835. else if (memoState == 28)
  836. {
  837. htmltext = "30171-12.html";
  838. }
  839. else if (memoState == 29)
  840. {
  841. htmltext = "30171-13.html";
  842. }
  843. break;
  844. }
  845. case BLACKSMITH_POITAN:
  846. {
  847. if (memoState < 5)
  848. {
  849. htmltext = "30458-01.html";
  850. }
  851. else if (memoState == 5)
  852. {
  853. htmltext = "30458-02.html";
  854. }
  855. else if (memoState == 6)
  856. {
  857. htmltext = "30458-04.html";
  858. }
  859. else if (memoState == 7)
  860. {
  861. htmltext = "30458-10.html";
  862. }
  863. break;
  864. }
  865. case MAGISTER_CLAYTON:
  866. {
  867. if (memoState < 2)
  868. {
  869. htmltext = "30464-01.html";
  870. }
  871. else if (memoState == 2)
  872. {
  873. qs.setMemoState(2);
  874. htmltext = "30464-02.html";
  875. }
  876. else if (memoState == 3)
  877. {
  878. if (getQuestItemsCount(player, ENMITY_CRYSTAL) < 30)
  879. {
  880. htmltext = "30464-07.html";
  881. }
  882. else
  883. {
  884. takeItems(player, ENMITY_CRYSTAL, -1);
  885. qs.setMemoState(4);
  886. htmltext = "30464-08.html";
  887. }
  888. }
  889. else if (memoState == 4)
  890. {
  891. giveItems(player, ENMITY_CRYSTAL_CORE, 1);
  892. qs.setMemoState(5);
  893. qs.setCond(5, true);
  894. htmltext = "30464-10.html";
  895. }
  896. else if (memoState == 5)
  897. {
  898. htmltext = "30464-12.html";
  899. }
  900. else if (memoState > 5)
  901. {
  902. htmltext = "30464-13.html";
  903. }
  904. break;
  905. }
  906. case MAGISTER_GAUEN:
  907. {
  908. if (memoState < 27)
  909. {
  910. htmltext = "30717-01.html";
  911. }
  912. else if (memoState == 27)
  913. {
  914. takeItems(player, MANASHENS_TALISMAN, -1);
  915. qs.setMemoState(28);
  916. htmltext = "30717-02.html";
  917. }
  918. else if (memoState == 28)
  919. {
  920. htmltext = "30717-04.html";
  921. }
  922. else if (memoState >= 29)
  923. {
  924. htmltext = "30717-10.html";
  925. }
  926. break;
  927. }
  928. case MAGISTER_KAIENA:
  929. {
  930. if (memoState < 29)
  931. {
  932. htmltext = "30720-01.html";
  933. }
  934. else if (memoState == 29)
  935. {
  936. htmltext = "30720-02.html";
  937. }
  938. if (memoState >= 30)
  939. {
  940. htmltext = "30720-05.html";
  941. }
  942. break;
  943. }
  944. case GRAND_MASTER_MELDINA:
  945. {
  946. if (memoState < 10)
  947. {
  948. htmltext = "32214-01.html";
  949. }
  950. else if (memoState == 10)
  951. {
  952. htmltext = "32214-02.html";
  953. }
  954. if (memoState == 11)
  955. {
  956. htmltext = "32214-05.html";
  957. }
  958. if (memoState > 11)
  959. {
  960. htmltext = "32214-06.html";
  961. }
  962. break;
  963. }
  964. case MASTER_SELSIA:
  965. {
  966. if (memoState < 11)
  967. {
  968. htmltext = "32220-01.html";
  969. }
  970. else if (memoState == 11)
  971. {
  972. htmltext = "32220-02.html";
  973. }
  974. else if (memoState == 12)
  975. {
  976. htmltext = "32220-04.html";
  977. }
  978. else if (memoState == 13)
  979. {
  980. if (qs.getMemoStateEx(1) == 0)
  981. {
  982. qs.setMemoStateEx(1, 0);
  983. htmltext = "32220-07.html";
  984. }
  985. else if (qs.getMemoStateEx(1) == 1)
  986. {
  987. qs.setMemoStateEx(1, 0);
  988. htmltext = "32220-08.html";
  989. }
  990. }
  991. else if (memoState == 20)
  992. {
  993. qs.setMemoState(21);
  994. qs.setCond(11, true);
  995. htmltext = "32220-14.html";
  996. }
  997. else if (memoState == 21)
  998. {
  999. htmltext = "32220-15.html";
  1000. }
  1001. else if (memoState == 22)
  1002. {
  1003. htmltext = "32220-16.html";
  1004. }
  1005. else if ((memoState >= 23) && (memoState < 30))
  1006. {
  1007. htmltext = "32220-17.html";
  1008. }
  1009. else if (memoState == 30)
  1010. {
  1011. qs.setMemoState(31);
  1012. htmltext = "32220-18.html";
  1013. }
  1014. else if (memoState == 31)
  1015. {
  1016. htmltext = "32220-20.html";
  1017. }
  1018. else if (memoState == 32)
  1019. {
  1020. if (!hasQuestItems(player, RESEARCH_ON_THE_GIANTS_AND_THE_ANCIENT_RACE))
  1021. {
  1022. htmltext = "32220-27.html";
  1023. }
  1024. else
  1025. {
  1026. giveAdena(player, 77666, true);
  1027. giveItems(player, KAMAEL_INQUISITOR_MARK, 1);
  1028. addExpAndSp(player, 429546, 29476);
  1029. qs.exitQuest(false, true);
  1030. player.sendPacket(new SocialAction(player.getObjectId(), 3));
  1031. htmltext = "32220-28.html";
  1032. }
  1033. }
  1034. break;
  1035. }
  1036. }
  1037. }
  1038. if (qs.isCompleted())
  1039. {
  1040. if (npc.getId() == MASTER_RINDY)
  1041. {
  1042. if (player.getClassId() == ClassId.arbalester)
  1043. {
  1044. htmltext = "32201-05.html";
  1045. }
  1046. else
  1047. {
  1048. htmltext = "32201-06.html";
  1049. }
  1050. }
  1051. }
  1052. return htmltext;
  1053. }
  1054. }