Q00236_SeedsOfChaos.java 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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.Q00236_SeedsOfChaos;
  20. import quests.Q00025_HidingBehindTheTruth.Q00025_HidingBehindTheTruth;
  21. import com.l2jserver.gameserver.enums.QuestSound;
  22. import com.l2jserver.gameserver.enums.Race;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.quest.Quest;
  26. import com.l2jserver.gameserver.model.quest.QuestState;
  27. import com.l2jserver.gameserver.network.NpcStringId;
  28. import com.l2jserver.gameserver.network.clientpackets.Say2;
  29. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  30. import com.l2jserver.gameserver.util.Util;
  31. /**
  32. * Seeds Of Chaos (236)
  33. * @author ivantotov
  34. */
  35. public final class Q00236_SeedsOfChaos extends Quest
  36. {
  37. // NPCs
  38. private static final int KURSTIN = 31387;
  39. private static final int MYSTERIOU_WIZARD = 31522;
  40. private static final int HIERARCH_KEKROPUS = 32138;
  41. private static final int VICE_HIERARCH_MAO = 32190;
  42. private static final int KATENAR = 32235;
  43. private static final int HARKILGAMED = 32236;
  44. private static final int RODENPICULA = 32237;
  45. private static final int ROCK = 32238;
  46. private static final int MOTHER_NORNIL = 32239;
  47. private static final int KATENAR_A = 32332;
  48. private static final int KATENAR_B = 32333;
  49. private static final int HARKILGAMED_A = 32334;
  50. // Items
  51. private static final int STAR_OF_DESTINY = 5011;
  52. private static final int SHINING_MEDALLION = 9743;
  53. private static final int BLOOD_JEWEL = 9744;
  54. private static final int BLACK_ECHO_CRYSTAL = 9745;
  55. // Reward
  56. private static final int SCROLL_ENCHANT_WEAPON_A_GRADE = 729;
  57. // Monster
  58. private static final int NEEDLE_STAKATO_DRONE = 21516;
  59. private static final int SHOUT_OF_SPLENDOR = 21532;
  60. private static final int ALLIANCE_OF_SPLENDOR = 21533;
  61. private static final int ALLIANCE_OF_SPLENDOR_1 = 21534;
  62. private static final int SIGNET_OF_SPLENDOR = 21535;
  63. private static final int CROWN_OF_SPLENDOR = 21536;
  64. private static final int FANG_OF_SPLENDOR = 21537;
  65. private static final int FANG_OF_SPLENDOR_1 = 21538;
  66. private static final int WAILINGOF_SPLENDOR = 21539;
  67. private static final int WAILINGOF_SPLENDOR_1 = 21540;
  68. private static final int VAMPIRE_WIZARD = 21588;
  69. private static final int VAMPIRE_WIZARD_A = 21589;
  70. // Misc
  71. private static final int MIN_LEVEL = 75;
  72. public Q00236_SeedsOfChaos()
  73. {
  74. super(236, Q00236_SeedsOfChaos.class.getSimpleName(), "Seeds Of Chaos");
  75. addStartNpc(HIERARCH_KEKROPUS);
  76. addTalkId(HIERARCH_KEKROPUS, KURSTIN, MYSTERIOU_WIZARD, VICE_HIERARCH_MAO, KATENAR, HARKILGAMED, RODENPICULA, ROCK, MOTHER_NORNIL, KATENAR_A, KATENAR_B, HARKILGAMED_A);
  77. addKillId(NEEDLE_STAKATO_DRONE, SHOUT_OF_SPLENDOR, ALLIANCE_OF_SPLENDOR, ALLIANCE_OF_SPLENDOR_1, SIGNET_OF_SPLENDOR, CROWN_OF_SPLENDOR, FANG_OF_SPLENDOR, FANG_OF_SPLENDOR_1, WAILINGOF_SPLENDOR, WAILINGOF_SPLENDOR_1, VAMPIRE_WIZARD, VAMPIRE_WIZARD_A);
  78. addSpawnId(KATENAR, HARKILGAMED, KATENAR_A, KATENAR_B, HARKILGAMED_A);
  79. registerQuestItems(SHINING_MEDALLION, BLOOD_JEWEL, BLACK_ECHO_CRYSTAL);
  80. }
  81. @Override
  82. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  83. {
  84. if ("KATENAR_120".equals(event))
  85. {
  86. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  87. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  88. if (npc0 != null)
  89. {
  90. if (npc0.getVariables().getBoolean("SPAWNED"))
  91. {
  92. npc0.getVariables().set("SPAWNED", false);
  93. if (c0 != null)
  94. {
  95. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO));
  96. }
  97. }
  98. }
  99. npc.deleteMe();
  100. return super.onAdvEvent(event, npc, player);
  101. }
  102. else if ("HARKILGAMED_120".equals(event))
  103. {
  104. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  105. if (npc0 != null)
  106. {
  107. if (npc0.getVariables().getBoolean("SPAWNED"))
  108. {
  109. npc0.getVariables().set("SPAWNED", false);
  110. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GRAAAH_WERE_BEING_ATTACKED));
  111. }
  112. }
  113. npc.deleteMe();
  114. return super.onAdvEvent(event, npc, player);
  115. }
  116. else if ("KATENAR_A_120".equals(event))
  117. {
  118. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  119. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  120. if (npc0 != null)
  121. {
  122. if (npc0.getVariables().getBoolean("SPAWNED"))
  123. {
  124. npc0.getVariables().set("SPAWNED", false);
  125. if (c0 != null)
  126. {
  127. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO));
  128. }
  129. }
  130. }
  131. npc.deleteMe();
  132. return super.onAdvEvent(event, npc, player);
  133. }
  134. else if ("KATENAR_B_120".equals(event))
  135. {
  136. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  137. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  138. if (npc0 != null)
  139. {
  140. if (npc0.getVariables().getBoolean("SPAWNED"))
  141. {
  142. npc0.getVariables().set("SPAWNED", false);
  143. if (c0 != null)
  144. {
  145. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_WHERE_DID_MY_FRIEND_GO));
  146. }
  147. }
  148. }
  149. npc.deleteMe();
  150. return super.onAdvEvent(event, npc, player);
  151. }
  152. else if ("HARKILGAMED_A_120".equals(event))
  153. {
  154. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  155. if (npc0 != null)
  156. {
  157. if (npc0.getVariables().getBoolean("SPAWNED"))
  158. {
  159. npc0.getVariables().set("SPAWNED", false);
  160. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.GRAAAH_WERE_BEING_ATTACKED));
  161. }
  162. }
  163. npc.deleteMe();
  164. return super.onAdvEvent(event, npc, player);
  165. }
  166. final QuestState qs = getQuestState(player, false);
  167. if (qs == null)
  168. {
  169. return null;
  170. }
  171. String htmltext = null;
  172. switch (event)
  173. {
  174. case "32138-04.htm":
  175. {
  176. if (qs.isCreated())
  177. {
  178. qs.setMemoState(1);
  179. qs.startQuest();
  180. htmltext = event;
  181. }
  182. break;
  183. }
  184. case "32138-03.htm":
  185. {
  186. if ((player.getLevel() >= MIN_LEVEL) && (player.getRace() == Race.KAMAEL) && hasQuestItems(player, STAR_OF_DESTINY))
  187. {
  188. htmltext = event;
  189. }
  190. break;
  191. }
  192. case "32138-12.html":
  193. {
  194. if (qs.isMemoState(30))
  195. {
  196. qs.setMemoState(40);
  197. qs.setCond(15, true);
  198. htmltext = event;
  199. }
  200. break;
  201. }
  202. case "31387-03.html":
  203. {
  204. if (qs.isMemoState(11))
  205. {
  206. takeItems(player, BLOOD_JEWEL, -1);
  207. qs.setMemoState(12);
  208. htmltext = event;
  209. }
  210. break;
  211. }
  212. case "31387-05a.html":
  213. {
  214. if (qs.isMemoState(12))
  215. {
  216. final QuestState q25 = player.getQuestState(Q00025_HidingBehindTheTruth.class.getSimpleName());
  217. if ((q25 != null) && q25.isCompleted())
  218. {
  219. htmltext = event;
  220. }
  221. else
  222. {
  223. htmltext = "31387-05b.html";
  224. }
  225. }
  226. break;
  227. }
  228. case "31387-10.html":
  229. {
  230. if (qs.isMemoState(12))
  231. {
  232. qs.setMemoState(20);
  233. qs.setMemoStateEx(1, 1);
  234. qs.setCond(11, true);
  235. htmltext = event;
  236. }
  237. else if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 1))
  238. {
  239. htmltext = event;
  240. }
  241. break;
  242. }
  243. case "31522-04a.html":
  244. {
  245. if (qs.isMemoState(1))
  246. {
  247. htmltext = event;
  248. }
  249. break;
  250. }
  251. case "31522-05a.html":
  252. {
  253. if (qs.isMemoState(1))
  254. {
  255. qs.setMemoState(2);
  256. qs.setCond(2, true);
  257. htmltext = event;
  258. }
  259. break;
  260. }
  261. case "31522-05b.html":
  262. {
  263. if (qs.isMemoState(1))
  264. {
  265. qs.setMemoState(3);
  266. qs.setMemoStateEx(1, 0);
  267. qs.setCond(6, true);
  268. htmltext = event;
  269. }
  270. break;
  271. }
  272. case "31522-09a.html":
  273. {
  274. if (qs.isMemoState(2) && hasQuestItems(player, BLACK_ECHO_CRYSTAL))
  275. {
  276. takeItems(player, BLACK_ECHO_CRYSTAL, -1);
  277. qs.setMemoState(6);
  278. qs.setCond(4, true);
  279. htmltext = event;
  280. }
  281. break;
  282. }
  283. case "31522-12a.html":
  284. {
  285. if (qs.isMemoState(6))
  286. {
  287. if (!npc.getVariables().getBoolean("SPAWNED", false))
  288. {
  289. npc.getVariables().set("SPAWNED", true);
  290. npc.getVariables().set("PLAYER_ID", player.getObjectId());
  291. final L2Npc katenar = addSpawn(KATENAR, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0);
  292. katenar.getVariables().set("npc0", npc);
  293. katenar.getVariables().set("player0", player);
  294. htmltext = event;
  295. }
  296. else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId())
  297. {
  298. htmltext = "31522-13a.html";
  299. }
  300. else
  301. {
  302. htmltext = "31522-14a.html";
  303. }
  304. }
  305. break;
  306. }
  307. case "31522-09b.html":
  308. {
  309. if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2))
  310. {
  311. if (!npc.getVariables().getBoolean("SPAWNED", false))
  312. {
  313. npc.getVariables().set("SPAWNED", true);
  314. npc.getVariables().set("PLAYER_ID", player.getObjectId());
  315. final L2Npc katenar = addSpawn(KATENAR_A, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0);
  316. katenar.getVariables().set("npc0", npc);
  317. katenar.getVariables().set("player0", player);
  318. htmltext = event;
  319. }
  320. else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId())
  321. {
  322. htmltext = "31522-10b.html";
  323. }
  324. else
  325. {
  326. htmltext = "31522-11b.html";
  327. }
  328. }
  329. break;
  330. }
  331. case "31522-14b.html":
  332. {
  333. if (qs.isMemoState(7) && hasQuestItems(player, BLOOD_JEWEL))
  334. {
  335. if (!npc.getVariables().getBoolean("SPAWNED", false))
  336. {
  337. npc.getVariables().set("SPAWNED", true);
  338. npc.getVariables().set("PLAYER_ID", player.getObjectId());
  339. final L2Npc katenar = addSpawn(KATENAR_B, player.getX() + 10, player.getY() + 10, player.getZ(), +10, false, 0);
  340. katenar.getVariables().set("npc0", npc);
  341. katenar.getVariables().set("player0", player);
  342. htmltext = event;
  343. }
  344. else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId())
  345. {
  346. htmltext = "31522-15b.html";
  347. }
  348. else
  349. {
  350. htmltext = "31522-15bz.html";
  351. }
  352. }
  353. break;
  354. }
  355. case "32235-09a.html":
  356. {
  357. if (qs.isMemoState(6))
  358. {
  359. qs.setMemoState(20);
  360. qs.setMemoStateEx(1, 0);
  361. qs.setCond(5, true);
  362. htmltext = event;
  363. }
  364. break;
  365. }
  366. case "32236-07.html":
  367. {
  368. if (qs.isMemoState(20))
  369. {
  370. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  371. if (c0 != null)
  372. {
  373. qs.setMemoState(21);
  374. qs.setMemoStateEx(1, 0);
  375. qs.setCond(12, true);
  376. }
  377. htmltext = event;
  378. }
  379. break;
  380. }
  381. case "32237-10.html":
  382. {
  383. if (qs.isMemoState(40))
  384. {
  385. htmltext = event;
  386. }
  387. break;
  388. }
  389. case "32237-11.html":
  390. {
  391. if (qs.isMemoState(40))
  392. {
  393. qs.setMemoState(42);
  394. qs.setCond(17, true);
  395. htmltext = event;
  396. }
  397. break;
  398. }
  399. case "32237-13.html":
  400. {
  401. if (qs.isMemoState(43))
  402. {
  403. qs.setMemoState(44);
  404. qs.setCond(19, true);
  405. htmltext = event;
  406. }
  407. break;
  408. }
  409. case "32237-17.html":
  410. {
  411. if (qs.isMemoState(45))
  412. {
  413. giveItems(player, SCROLL_ENCHANT_WEAPON_A_GRADE, 1);
  414. takeItems(player, STAR_OF_DESTINY, 1);
  415. qs.exitQuest(false, true);
  416. htmltext = event;
  417. }
  418. break;
  419. }
  420. case "32238-02.html":
  421. {
  422. if (qs.isMemoState(20))
  423. {
  424. if (!npc.getVariables().getBoolean("SPAWNED", false))
  425. {
  426. npc.getVariables().set("SPAWNED", true);
  427. npc.getVariables().set("PLAYER_ID", player.getObjectId());
  428. final L2Npc kamael = addSpawn(HARKILGAMED, 71722, -78853, -4464, 0, false, 0);
  429. kamael.getVariables().set("npc0", npc);
  430. kamael.getVariables().set("player0", player);
  431. htmltext = event;
  432. }
  433. else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId())
  434. {
  435. htmltext = "32238-03.html";
  436. }
  437. else
  438. {
  439. htmltext = "32238-04z.html";
  440. }
  441. }
  442. break;
  443. }
  444. case "32238-06.html":
  445. {
  446. if (qs.isMemoState(22))
  447. {
  448. if (!npc.getVariables().getBoolean("SPAWNED", false))
  449. {
  450. npc.getVariables().set("SPAWNED", true);
  451. npc.getVariables().set("PLAYER_ID", player.getObjectId());
  452. final L2Npc kamael = addSpawn(HARKILGAMED_A, 71722, -78853, -4464, 0, false, 0);
  453. kamael.getVariables().set("npc0", npc);
  454. kamael.getVariables().set("player0", player);
  455. htmltext = event;
  456. }
  457. else if (npc.getVariables().getInt("PLAYER_ID") == player.getObjectId())
  458. {
  459. htmltext = "32238-07.html";
  460. }
  461. else
  462. {
  463. htmltext = "32238-08.html";
  464. }
  465. }
  466. break;
  467. }
  468. case "32239-04.html":
  469. {
  470. if (qs.isMemoState(42))
  471. {
  472. qs.setMemoState(43);
  473. qs.setCond(18, true);
  474. htmltext = event;
  475. }
  476. break;
  477. }
  478. case "32239-08.html":
  479. {
  480. if (qs.isMemoState(44))
  481. {
  482. qs.setMemoState(45);
  483. qs.setCond(20, true);
  484. htmltext = event;
  485. }
  486. break;
  487. }
  488. case "32332-05b.html":
  489. {
  490. if (qs.isMemoState(3) && (qs.getMemoStateEx(1) == 2))
  491. {
  492. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  493. if (c0 != null)
  494. {
  495. qs.setMemoState(7);
  496. qs.setMemoStateEx(1, 0);
  497. qs.setCond(8, true);
  498. }
  499. htmltext = event;
  500. }
  501. break;
  502. }
  503. case "32334-17.html":
  504. {
  505. if (qs.isMemoState(22))
  506. {
  507. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  508. if (c0 != null)
  509. {
  510. takeItems(player, SHINING_MEDALLION, -1);
  511. qs.setMemoState(30);
  512. qs.setCond(14, true);
  513. }
  514. htmltext = event;
  515. }
  516. break;
  517. }
  518. case "KEITNAR_DESPAWN":
  519. {
  520. if (qs.isMemoState(20) && (qs.getMemoStateEx(1) == 0))
  521. {
  522. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  523. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  524. if (player == c0)
  525. {
  526. if (npc0 != null)
  527. {
  528. npc0.getVariables().set("SPAWNED", false);
  529. }
  530. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS));
  531. npc.deleteMe();
  532. }
  533. }
  534. break;
  535. }
  536. case "HARKILGAMED_DESPAWN":
  537. {
  538. if (qs.isMemoState(21))
  539. {
  540. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  541. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  542. if (player == c0)
  543. {
  544. if (npc0 != null)
  545. {
  546. npc0.getVariables().set("SPAWNED", false);
  547. }
  548. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.IN_THAT_CASE_I_WISH_YOU_GOOD_LUCK));
  549. npc.deleteMe();
  550. }
  551. }
  552. break;
  553. }
  554. case "KEITNAR_A_DESPAWN":
  555. {
  556. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  557. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  558. if (player == c0)
  559. {
  560. if (npc0 != null)
  561. {
  562. npc0.getVariables().set("SPAWNED", false);
  563. }
  564. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS));
  565. npc.deleteMe();
  566. }
  567. break;
  568. }
  569. case "KEITNAR_B_DESPAWN":
  570. {
  571. if (qs.isMemoState(11) && hasQuestItems(player, BLOOD_JEWEL))
  572. {
  573. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  574. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  575. if (player == c0)
  576. {
  577. if (npc0 != null)
  578. {
  579. npc0.getVariables().set("SPAWNED", false);
  580. }
  581. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.BEST_OF_LUCK_WITH_YOUR_FUTURE_ENDEAVOURS));
  582. npc.deleteMe();
  583. }
  584. }
  585. break;
  586. }
  587. case "HARKILGAMED_A_DESPAWN":
  588. {
  589. if (qs.isMemoState(30))
  590. {
  591. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  592. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  593. if (player == c0)
  594. {
  595. if (npc0 != null)
  596. {
  597. npc0.getVariables().set("SPAWNED", false);
  598. }
  599. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.SAFE_TRAVELS));
  600. npc.deleteMe();
  601. }
  602. }
  603. break;
  604. }
  605. case "31387-02.html":
  606. case "31387-04.html":
  607. case "31387-06.html":
  608. case "31387-07.html":
  609. case "31387-08.html":
  610. case "31522-02.html":
  611. case "31522-03.html":
  612. case "31522-04b.html":
  613. case "31522-08a.html":
  614. case "31522-11a.html":
  615. case "32138-02.html":
  616. case "32138-07.html":
  617. case "32138-08.html":
  618. case "32138-09.html":
  619. case "32138-10.html":
  620. case "32138-11.html":
  621. case "32235-02a.html":
  622. case "32235-03a.html":
  623. case "32235-04a.html":
  624. case "32235-05a.html":
  625. case "32235-06a.html":
  626. case "32235-08a.html":
  627. case "32236-03.html":
  628. case "32236-04.html":
  629. case "32236-05.html":
  630. case "32236-06.html":
  631. case "32237-02.html":
  632. case "32237-03.html":
  633. case "32237-04.html":
  634. case "32237-05.html":
  635. case "32237-06.html":
  636. case "32237-07.html":
  637. case "32237-08.html":
  638. case "32237-16.html":
  639. case "32237-18.html":
  640. case "32239-03.html":
  641. case "32239-07.html":
  642. case "32332-02b.html":
  643. case "32332-03b.html":
  644. case "32332-04b.html":
  645. case "32334-10.html":
  646. case "32334-11.html":
  647. case "32334-12.html":
  648. case "32334-13.html":
  649. case "32334-14.html":
  650. case "32334-15.html":
  651. case "32334-16.html":
  652. {
  653. htmltext = event;
  654. break;
  655. }
  656. }
  657. return htmltext;
  658. }
  659. @Override
  660. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  661. {
  662. final QuestState qs = getQuestState(killer, false);
  663. if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true))
  664. {
  665. switch (npc.getId())
  666. {
  667. case NEEDLE_STAKATO_DRONE:
  668. {
  669. if (qs.isMemoState(2) && !hasQuestItems(killer, BLACK_ECHO_CRYSTAL))
  670. {
  671. if (getRandom(100) < 20)
  672. {
  673. giveItems(killer, BLACK_ECHO_CRYSTAL, 1);
  674. qs.setCond(3, true);
  675. }
  676. }
  677. break;
  678. }
  679. case SHOUT_OF_SPLENDOR:
  680. case ALLIANCE_OF_SPLENDOR:
  681. case ALLIANCE_OF_SPLENDOR_1:
  682. case SIGNET_OF_SPLENDOR:
  683. case CROWN_OF_SPLENDOR:
  684. case FANG_OF_SPLENDOR:
  685. case FANG_OF_SPLENDOR_1:
  686. case WAILINGOF_SPLENDOR:
  687. case WAILINGOF_SPLENDOR_1:
  688. {
  689. if (qs.isMemoState(21) && (getQuestItemsCount(killer, SHINING_MEDALLION) < 62))
  690. {
  691. if (getRandom(100) < 70)
  692. {
  693. giveItems(killer, SHINING_MEDALLION, 1);
  694. if (getQuestItemsCount(killer, SHINING_MEDALLION) == 62)
  695. {
  696. qs.setMemoState(22);
  697. qs.setCond(13, true);
  698. }
  699. else
  700. {
  701. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  702. }
  703. }
  704. }
  705. break;
  706. }
  707. case VAMPIRE_WIZARD:
  708. case VAMPIRE_WIZARD_A:
  709. {
  710. if (qs.isMemoState(7) && !hasQuestItems(killer, BLOOD_JEWEL))
  711. {
  712. if (getRandom(100) < 8)
  713. {
  714. giveItems(killer, BLOOD_JEWEL, 1);
  715. qs.setCond(9, true);
  716. }
  717. }
  718. break;
  719. }
  720. }
  721. }
  722. return super.onKill(npc, killer, isSummon);
  723. }
  724. @Override
  725. public String onTalk(L2Npc npc, L2PcInstance player)
  726. {
  727. final QuestState qs = getQuestState(player, true);
  728. String htmltext = getNoQuestMsg(player);
  729. if (qs.isCreated())
  730. {
  731. if (npc.getId() == HIERARCH_KEKROPUS)
  732. {
  733. if (player.getLevel() >= MIN_LEVEL)
  734. {
  735. if (player.getRace() == Race.KAMAEL)
  736. {
  737. if (hasQuestItems(player, STAR_OF_DESTINY))
  738. {
  739. htmltext = "32138-01.htm";
  740. }
  741. else
  742. {
  743. htmltext = "32138-01x.html";
  744. }
  745. }
  746. else
  747. {
  748. htmltext = "32138-01y.html";
  749. }
  750. }
  751. else
  752. {
  753. htmltext = "32138-01z.html";
  754. }
  755. }
  756. }
  757. else if (qs.isStarted())
  758. {
  759. switch (npc.getId())
  760. {
  761. case HIERARCH_KEKROPUS:
  762. {
  763. switch (qs.getMemoState())
  764. {
  765. case 1:
  766. {
  767. htmltext = "32138-05.html";
  768. break;
  769. }
  770. case 30:
  771. {
  772. htmltext = "32138-06.html";
  773. break;
  774. }
  775. case 40:
  776. {
  777. htmltext = "32138-13.html";
  778. break;
  779. }
  780. }
  781. break;
  782. }
  783. case KURSTIN:
  784. {
  785. switch (qs.getMemoState())
  786. {
  787. case 11:
  788. {
  789. htmltext = "31387-01.html";
  790. break;
  791. }
  792. case 12:
  793. {
  794. htmltext = "31387-04.html";
  795. break;
  796. }
  797. case 20:
  798. {
  799. if (qs.getMemoStateEx(1) == 1)
  800. {
  801. htmltext = "31387-11.html";
  802. }
  803. break;
  804. }
  805. }
  806. break;
  807. }
  808. case MYSTERIOU_WIZARD:
  809. {
  810. switch (qs.getMemoState())
  811. {
  812. case 1:
  813. {
  814. htmltext = "31522-01.html";
  815. break;
  816. }
  817. case 2:
  818. {
  819. if (!hasQuestItems(player, BLACK_ECHO_CRYSTAL))
  820. {
  821. htmltext = "31522-06a.html";
  822. }
  823. else
  824. {
  825. htmltext = "31522-07a.html";
  826. }
  827. break;
  828. }
  829. case 6:
  830. {
  831. htmltext = "31522-10a.html";
  832. break;
  833. }
  834. case 20:
  835. {
  836. if (qs.getMemoStateEx(1) == 0)
  837. {
  838. htmltext = "31522-15a.html";
  839. }
  840. break;
  841. }
  842. case 3:
  843. {
  844. if (qs.getMemoStateEx(1) == 0)
  845. {
  846. qs.setMemoStateEx(1, 1);
  847. htmltext = "31522-06b.html";
  848. }
  849. else if (qs.getMemoStateEx(1) == 1)
  850. {
  851. qs.setMemoStateEx(1, 2);
  852. qs.setCond(7, true);
  853. htmltext = "31522-07b.html";
  854. }
  855. else if (qs.getMemoStateEx(1) == 2)
  856. {
  857. htmltext = "31522-08b.html";
  858. }
  859. break;
  860. }
  861. case 7:
  862. {
  863. if (!hasQuestItems(player, BLOOD_JEWEL))
  864. {
  865. htmltext = "31522-12b.html";
  866. }
  867. else
  868. {
  869. htmltext = "31522-13b.html";
  870. }
  871. break;
  872. }
  873. case 11:
  874. {
  875. htmltext = "31522-16b.html";
  876. break;
  877. }
  878. }
  879. break;
  880. }
  881. case VICE_HIERARCH_MAO:
  882. {
  883. if ((qs.getMemoState() >= 40) && (qs.getMemoState() <= 45))
  884. {
  885. htmltext = "32190-01.html";
  886. }
  887. break;
  888. }
  889. case KATENAR:
  890. {
  891. switch (qs.getMemoState())
  892. {
  893. case 6:
  894. {
  895. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  896. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  897. npc0.getVariables().set("SPAWNED", false);
  898. if (player == c0)
  899. {
  900. htmltext = "32235-01a.html";
  901. }
  902. else
  903. {
  904. htmltext = "32235-01z.html";
  905. }
  906. break;
  907. }
  908. case 20:
  909. {
  910. if (qs.getMemoStateEx(1) == 0)
  911. {
  912. htmltext = "32235-09z.html";
  913. }
  914. break;
  915. }
  916. }
  917. break;
  918. }
  919. case HARKILGAMED:
  920. {
  921. switch (qs.getMemoState())
  922. {
  923. case 20:
  924. {
  925. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  926. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  927. npc0.getVariables().set("SPAWNED", false);
  928. if (player == c0)
  929. {
  930. htmltext = "32236-01.html";
  931. }
  932. else
  933. {
  934. htmltext = "32236-02.html";
  935. }
  936. break;
  937. }
  938. case 21:
  939. {
  940. htmltext = "32236-07z.html";
  941. break;
  942. }
  943. case 22:
  944. {
  945. htmltext = "32236-08z.html";
  946. break;
  947. }
  948. }
  949. break;
  950. }
  951. case RODENPICULA:
  952. {
  953. switch (qs.getMemoState())
  954. {
  955. case 40:
  956. {
  957. htmltext = "32237-01.html";
  958. break;
  959. }
  960. case 42:
  961. {
  962. htmltext = "32237-11a.html";
  963. break;
  964. }
  965. case 43:
  966. {
  967. htmltext = "32237-12.html";
  968. break;
  969. }
  970. case 44:
  971. {
  972. htmltext = "32237-14.html";
  973. break;
  974. }
  975. case 45:
  976. {
  977. htmltext = "32237-15.html";
  978. break;
  979. }
  980. }
  981. break;
  982. }
  983. case ROCK:
  984. {
  985. switch (qs.getMemoState())
  986. {
  987. case 20:
  988. {
  989. htmltext = "32238-01.html";
  990. break;
  991. }
  992. case 21:
  993. {
  994. htmltext = "32238-04.html";
  995. break;
  996. }
  997. case 22:
  998. {
  999. htmltext = "32238-05.html";
  1000. break;
  1001. }
  1002. case 30:
  1003. {
  1004. htmltext = "32238-09.html";
  1005. break;
  1006. }
  1007. }
  1008. break;
  1009. }
  1010. case MOTHER_NORNIL:
  1011. {
  1012. switch (qs.getMemoState())
  1013. {
  1014. case 40:
  1015. {
  1016. htmltext = "32239-01.html";
  1017. break;
  1018. }
  1019. case 42:
  1020. {
  1021. htmltext = "32239-02.html";
  1022. break;
  1023. }
  1024. case 43:
  1025. {
  1026. htmltext = "32239-05.html";
  1027. break;
  1028. }
  1029. case 44:
  1030. {
  1031. htmltext = "32239-06.html";
  1032. break;
  1033. }
  1034. case 45:
  1035. {
  1036. htmltext = "32239-09.html";
  1037. break;
  1038. }
  1039. }
  1040. break;
  1041. }
  1042. case KATENAR_A:
  1043. {
  1044. switch (qs.getMemoState())
  1045. {
  1046. case 3:
  1047. {
  1048. if (qs.getMemoStateEx(1) == 2)
  1049. {
  1050. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1051. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  1052. npc0.getVariables().set("SPAWNED", false);
  1053. if (player == c0)
  1054. {
  1055. htmltext = "32332-01b.html";
  1056. }
  1057. else
  1058. {
  1059. htmltext = "32332-01z.html";
  1060. }
  1061. }
  1062. break;
  1063. }
  1064. case 7:
  1065. {
  1066. if (!hasQuestItems(player, BLOOD_JEWEL))
  1067. {
  1068. htmltext = "32332-05z.html";
  1069. }
  1070. break;
  1071. }
  1072. }
  1073. break;
  1074. }
  1075. case KATENAR_B:
  1076. {
  1077. switch (qs.getMemoState())
  1078. {
  1079. case 7:
  1080. {
  1081. if (hasQuestItems(player, BLOOD_JEWEL))
  1082. {
  1083. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1084. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  1085. npc0.getVariables().set("SPAWNED", false);
  1086. if (player == c0)
  1087. {
  1088. qs.setMemoState(11);
  1089. qs.setCond(10, true);
  1090. htmltext = "32333-06bz.html";
  1091. }
  1092. else
  1093. {
  1094. qs.setMemoState(11);
  1095. qs.setCond(10, true);
  1096. htmltext = "32333-06b.html";
  1097. }
  1098. }
  1099. break;
  1100. }
  1101. case 11:
  1102. {
  1103. htmltext = "32333-06b.html";
  1104. break;
  1105. }
  1106. }
  1107. break;
  1108. }
  1109. case HARKILGAMED_A:
  1110. {
  1111. switch (qs.getMemoState())
  1112. {
  1113. case 22:
  1114. {
  1115. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1116. final L2Npc npc0 = npc.getVariables().getObject("npc0", L2Npc.class);
  1117. npc0.getVariables().set("SPAWNED", false);
  1118. if (player == c0)
  1119. {
  1120. htmltext = "32334-08.html";
  1121. }
  1122. else
  1123. {
  1124. htmltext = "32334-09.html";
  1125. }
  1126. break;
  1127. }
  1128. case 30:
  1129. {
  1130. htmltext = "32334-18.html";
  1131. break;
  1132. }
  1133. }
  1134. break;
  1135. }
  1136. }
  1137. }
  1138. else if (qs.isCompleted())
  1139. {
  1140. if (npc.getId() == HIERARCH_KEKROPUS)
  1141. {
  1142. htmltext = getAlreadyCompletedMsg(player);
  1143. }
  1144. }
  1145. return htmltext;
  1146. }
  1147. @Override
  1148. public String onSpawn(L2Npc npc)
  1149. {
  1150. switch (npc.getId())
  1151. {
  1152. case KATENAR:
  1153. {
  1154. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1155. startQuestTimer("KATENAR_120", 120000, npc, null);
  1156. if (c0 != null)
  1157. {
  1158. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_FINALLY_WE_MEET).addStringParameter(c0.getAppearance().getVisibleName()));
  1159. }
  1160. break;
  1161. }
  1162. case HARKILGAMED:
  1163. {
  1164. startQuestTimer("HARKILGAMED_120", 120000, npc, null);
  1165. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.HMM_IS_SOMEONE_APPROACHING));
  1166. break;
  1167. }
  1168. case KATENAR_A:
  1169. {
  1170. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1171. startQuestTimer("KATENAR_A_120", 120000, npc, null);
  1172. if (c0 != null)
  1173. {
  1174. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_DID_YOU_WAIT_FOR_LONG).addStringParameter(c0.getAppearance().getVisibleName()));
  1175. }
  1176. break;
  1177. }
  1178. case KATENAR_B:
  1179. {
  1180. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1181. startQuestTimer("KATENAR_B_120", 120000, npc, null);
  1182. if (c0 != null)
  1183. {
  1184. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.DID_YOU_BRING_WHAT_I_ASKED_S1).addStringParameter(c0.getAppearance().getVisibleName()));
  1185. }
  1186. break;
  1187. }
  1188. case HARKILGAMED_A:
  1189. {
  1190. final L2PcInstance c0 = npc.getVariables().getObject("player0", L2PcInstance.class);
  1191. startQuestTimer("HARKILGAMED_A_120", 120000, npc, null);
  1192. if (c0 != null)
  1193. {
  1194. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_HAS_EVERYTHING_BEEN_FOUND).addStringParameter(c0.getAppearance().getVisibleName()));
  1195. }
  1196. break;
  1197. }
  1198. }
  1199. return super.onSpawn(npc);
  1200. }
  1201. }