Q00229_TestOfWitchcraft.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  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.Q00229_TestOfWitchcraft;
  20. import com.l2jserver.gameserver.enums.QuestSound;
  21. import com.l2jserver.gameserver.model.Location;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.base.ClassId;
  25. import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  26. import com.l2jserver.gameserver.model.quest.Quest;
  27. import com.l2jserver.gameserver.model.quest.QuestState;
  28. import com.l2jserver.gameserver.network.NpcStringId;
  29. import com.l2jserver.gameserver.network.clientpackets.Say2;
  30. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  31. import com.l2jserver.gameserver.network.serverpackets.SocialAction;
  32. import com.l2jserver.gameserver.util.Util;
  33. /**
  34. * Test Of Witchcraft (229)
  35. * @author ivantotov
  36. */
  37. public final class Q00229_TestOfWitchcraft extends Quest
  38. {
  39. // NPCs
  40. private static final int GROCER_LARA = 30063;
  41. private static final int TRADER_ALEXANDRIA = 30098;
  42. private static final int MAGISTER_IKER = 30110;
  43. private static final int PRIEST_VADIN = 30188;
  44. private static final int TRADER_NESTLE = 30314;
  45. private static final int SIR_KLAUS_VASPER = 30417;
  46. private static final int LEOPOLD = 30435;
  47. private static final int MAGISTER_KAIRA = 30476;
  48. private static final int SHADOW_ORIM = 30630;
  49. private static final int WARDEN_RODERIK = 30631;
  50. private static final int WARDEN_ENDRIGO = 30632;
  51. private static final int FISHER_EVERT = 30633;
  52. // Items
  53. private static final int SWORD_OF_BINDING = 3029;
  54. private static final int ORIMS_DIAGRAM = 3308;
  55. private static final int ALEXANDRIAS_BOOK = 3309;
  56. private static final int IKERS_LIST = 3310;
  57. private static final int DIRE_WYRM_FANG = 3311;
  58. private static final int LETO_LIZARDMAN_CHARM = 3312;
  59. private static final int ENCHANTED_STONE_GOLEM_HEARTSTONE = 3313;
  60. private static final int LARAS_MEMO = 3314;
  61. private static final int NESTLES_MEMO = 3315;
  62. private static final int LEOPOLDS_JOURNAL = 3316;
  63. private static final int AKLANTOTH_1ST_GEM = 3317;
  64. private static final int AKLANTOTH_2ND_GEM = 3318;
  65. private static final int AKLANTOTH_3RD_GEM = 3319;
  66. private static final int AKLANTOTH_4TH_GEM = 3320;
  67. private static final int AKLANTOTH_5TH_GEM = 3321;
  68. private static final int AKLANTOTH_6TH_GEM = 3322;
  69. private static final int BRIMSTONE_1ST = 3323;
  70. private static final int ORIMS_INSTRUCTIONS = 3324;
  71. private static final int ORIMS_1ST_LETTER = 3325;
  72. private static final int ORIMS_2ND_LETTER = 3326;
  73. private static final int SIR_VASPERS_LETTER = 3327;
  74. private static final int VADINS_CRUCIFIX = 3328;
  75. private static final int TAMLIN_ORC_AMULET = 3329;
  76. private static final int VADINS_SANCTIONS = 3330;
  77. private static final int IKERS_AMULET = 3331;
  78. private static final int SOULTRAP_CRYSTAL = 3332;
  79. private static final int PURGATORY_KEY = 3333;
  80. private static final int ZERUEL_BIND_CRYSTAL = 3334;
  81. private static final int BRIMSTONE_2ND = 3335;
  82. // Reward
  83. private static final int MARK_OF_WITCHCRAFT = 3307;
  84. private static final int DIMENSIONAL_DIAMOND = 7562;
  85. // Monster
  86. private static final int DIRE_WYRM = 20557;
  87. private static final int ENCHANTED_STONE_GOLEM = 20565;
  88. private static final int LETO_LIZARDMAN = 20577;
  89. private static final int LETO_LIZARDMAN_ARCHER = 20578;
  90. private static final int LETO_LIZARDMAN_SOLDIER = 20579;
  91. private static final int LETO_LIZARDMAN_WARRIOR = 20580;
  92. private static final int LETO_LIZARDMAN_SHAMAN = 20581;
  93. private static final int LETO_LIZARDMAN_OVERLORD = 20582;
  94. private static final int TAMLIN_ORC = 20601;
  95. private static final int TAMLIN_ORC_ARCHER = 20602;
  96. // Quest Monster
  97. private static final int NAMELESS_REVENANT = 27099;
  98. private static final int SKELETAL_MERCENARY = 27100;
  99. private static final int DREVANUL_PRINCE_ZERUEL = 27101;
  100. // Misc
  101. private static final int MIN_LEVEL = 39;
  102. // Locations
  103. private static final Location DREVANUL_PRINCE_ZERUEL_SPAWN = new Location(13395, 169807, -3708);
  104. public Q00229_TestOfWitchcraft()
  105. {
  106. super(229, Q00229_TestOfWitchcraft.class.getSimpleName(), "Test Of Witchcraft");
  107. {
  108. addStartNpc(SHADOW_ORIM);
  109. addTalkId(SHADOW_ORIM, GROCER_LARA, TRADER_ALEXANDRIA, MAGISTER_IKER, PRIEST_VADIN, TRADER_NESTLE, SIR_KLAUS_VASPER, LEOPOLD, MAGISTER_KAIRA, WARDEN_RODERIK, WARDEN_ENDRIGO, FISHER_EVERT);
  110. addKillId(DIRE_WYRM, ENCHANTED_STONE_GOLEM, LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_SHAMAN, LETO_LIZARDMAN_OVERLORD, TAMLIN_ORC, TAMLIN_ORC_ARCHER, NAMELESS_REVENANT, SKELETAL_MERCENARY, DREVANUL_PRINCE_ZERUEL);
  111. addAttackId(NAMELESS_REVENANT, SKELETAL_MERCENARY, DREVANUL_PRINCE_ZERUEL);
  112. registerQuestItems(SWORD_OF_BINDING, ORIMS_DIAGRAM, ALEXANDRIAS_BOOK, IKERS_LIST, DIRE_WYRM_FANG, LETO_LIZARDMAN_CHARM, ENCHANTED_STONE_GOLEM_HEARTSTONE, LARAS_MEMO, NESTLES_MEMO, LEOPOLDS_JOURNAL, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS, ORIMS_1ST_LETTER, ORIMS_2ND_LETTER, SIR_VASPERS_LETTER, VADINS_CRUCIFIX, TAMLIN_ORC_AMULET, VADINS_SANCTIONS, IKERS_AMULET, SOULTRAP_CRYSTAL, PURGATORY_KEY, ZERUEL_BIND_CRYSTAL, BRIMSTONE_2ND);
  113. }
  114. }
  115. @Override
  116. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  117. {
  118. final QuestState qs = getQuestState(player, false);
  119. if (qs == null)
  120. {
  121. return null;
  122. }
  123. String htmltext = null;
  124. switch (event)
  125. {
  126. case "ACCEPT":
  127. {
  128. if (qs.isCreated())
  129. {
  130. qs.startQuest();
  131. playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  132. giveItems(player, ORIMS_DIAGRAM, 1);
  133. if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0)
  134. {
  135. if (player.getClassId() == ClassId.wizard)
  136. {
  137. giveItems(player, DIMENSIONAL_DIAMOND, 122);
  138. }
  139. else
  140. {
  141. giveItems(player, DIMENSIONAL_DIAMOND, 104);
  142. }
  143. player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
  144. htmltext = "30630-08a.htm";
  145. }
  146. else
  147. {
  148. htmltext = "30630-08.htm";
  149. }
  150. }
  151. break;
  152. }
  153. case "30630-04.htm":
  154. case "30630-06.htm":
  155. case "30630-07.htm":
  156. case "30630-12.htm":
  157. case "30630-13.htm":
  158. case "30630-20.htm":
  159. case "30630-21.htm":
  160. case "30098-02.htm":
  161. case "30110-02.htm":
  162. case "30417-02.htm":
  163. {
  164. htmltext = event;
  165. break;
  166. }
  167. case "30630-14.htm":
  168. {
  169. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  170. {
  171. takeItems(player, ALEXANDRIAS_BOOK, 1);
  172. takeItems(player, AKLANTOTH_1ST_GEM, 1);
  173. takeItems(player, AKLANTOTH_2ND_GEM, 1);
  174. takeItems(player, AKLANTOTH_3RD_GEM, 1);
  175. takeItems(player, AKLANTOTH_4TH_GEM, 1);
  176. takeItems(player, AKLANTOTH_5TH_GEM, 1);
  177. takeItems(player, AKLANTOTH_6TH_GEM, 1);
  178. giveItems(player, BRIMSTONE_1ST, 1);
  179. qs.setCond(4, true);
  180. addSpawn(DREVANUL_PRINCE_ZERUEL, npc, true, 0, false);
  181. htmltext = event;
  182. }
  183. break;
  184. }
  185. case "30630-16.htm":
  186. {
  187. if (hasQuestItems(player, BRIMSTONE_1ST))
  188. {
  189. takeItems(player, BRIMSTONE_1ST, 1);
  190. giveItems(player, ORIMS_INSTRUCTIONS, 1);
  191. giveItems(player, ORIMS_1ST_LETTER, 1);
  192. giveItems(player, ORIMS_2ND_LETTER, 1);
  193. qs.setCond(6, true);
  194. htmltext = event;
  195. }
  196. break;
  197. }
  198. case "30630-22.htm":
  199. {
  200. if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL))
  201. {
  202. giveAdena(player, 372154, true);
  203. giveItems(player, MARK_OF_WITCHCRAFT, 1);
  204. addExpAndSp(player, 2058244, 141240);
  205. qs.exitQuest(false, true);
  206. player.sendPacket(new SocialAction(player.getObjectId(), 3));
  207. htmltext = event;
  208. }
  209. break;
  210. }
  211. case "30063-02.htm":
  212. {
  213. giveItems(player, LARAS_MEMO, 1);
  214. htmltext = event;
  215. break;
  216. }
  217. case "30098-03.htm":
  218. {
  219. if (hasQuestItems(player, ORIMS_DIAGRAM))
  220. {
  221. takeItems(player, ORIMS_DIAGRAM, 1);
  222. giveItems(player, ALEXANDRIAS_BOOK, 1);
  223. qs.setCond(2, true);
  224. htmltext = event;
  225. }
  226. break;
  227. }
  228. case "30110-03.htm":
  229. {
  230. giveItems(player, IKERS_LIST, 1);
  231. htmltext = event;
  232. break;
  233. }
  234. case "30110-08.htm":
  235. {
  236. takeItems(player, ORIMS_2ND_LETTER, 1);
  237. giveItems(player, IKERS_AMULET, 1);
  238. giveItems(player, SOULTRAP_CRYSTAL, 1);
  239. if (hasQuestItems(player, SWORD_OF_BINDING))
  240. {
  241. qs.setCond(7, true);
  242. }
  243. htmltext = event;
  244. break;
  245. }
  246. case "30314-02.htm":
  247. {
  248. giveItems(player, NESTLES_MEMO, 1);
  249. htmltext = event;
  250. break;
  251. }
  252. case "30417-03.htm":
  253. {
  254. if (hasQuestItems(player, ORIMS_1ST_LETTER))
  255. {
  256. takeItems(player, ORIMS_1ST_LETTER, 1);
  257. giveItems(player, SIR_VASPERS_LETTER, 1);
  258. htmltext = event;
  259. }
  260. break;
  261. }
  262. case "30435-02.htm":
  263. {
  264. if (hasQuestItems(player, NESTLES_MEMO))
  265. {
  266. takeItems(player, NESTLES_MEMO, 1);
  267. giveItems(player, LEOPOLDS_JOURNAL, 1);
  268. htmltext = event;
  269. }
  270. break;
  271. }
  272. case "30476-02.htm":
  273. {
  274. giveItems(player, AKLANTOTH_2ND_GEM, 1);
  275. if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  276. {
  277. qs.setCond(3, true);
  278. }
  279. htmltext = event;
  280. break;
  281. }
  282. case "30633-02.htm":
  283. {
  284. giveItems(player, BRIMSTONE_2ND, 1);
  285. qs.setCond(9, true);
  286. if (npc.getSummonedNpcCount() < 1)
  287. {
  288. addSpawn(npc, DREVANUL_PRINCE_ZERUEL, DREVANUL_PRINCE_ZERUEL_SPAWN, false, 0);
  289. }
  290. htmltext = event;
  291. break;
  292. }
  293. }
  294. return htmltext;
  295. }
  296. @Override
  297. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  298. {
  299. final QuestState qs = getQuestState(attacker, false);
  300. if ((qs != null) && qs.isStarted())
  301. {
  302. switch (npc.getId())
  303. {
  304. case NAMELESS_REVENANT:
  305. {
  306. if (npc.isScriptValue(0) && hasQuestItems(attacker, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(attacker, AKLANTOTH_3RD_GEM))
  307. {
  308. npc.setScriptValue(1);
  309. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_ABSOLUTELY_CANNOT_GIVE_IT_TO_YOU_IT_IS_MY_PRECIOUS_JEWEL));
  310. }
  311. break;
  312. }
  313. case SKELETAL_MERCENARY:
  314. {
  315. if (npc.isScriptValue(0) && hasQuestItems(attacker, LEOPOLDS_JOURNAL) && !hasQuestItems(attacker, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  316. {
  317. npc.setScriptValue(1);
  318. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.I_ABSOLUTELY_CANNOT_GIVE_IT_TO_YOU_IT_IS_MY_PRECIOUS_JEWEL));
  319. }
  320. break;
  321. }
  322. case DREVANUL_PRINCE_ZERUEL:
  323. {
  324. if (hasQuestItems(attacker, BRIMSTONE_1ST))
  325. {
  326. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.ILL_TAKE_YOUR_LIVES_LATER));
  327. npc.deleteMe();
  328. qs.setCond(5, true);
  329. }
  330. else if (hasQuestItems(attacker, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL))
  331. {
  332. if (npc.isScriptValue(0) && checkWeapon(attacker))
  333. {
  334. npc.setScriptValue(1);
  335. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.THAT_SWORD_IS_REALLY));
  336. }
  337. }
  338. break;
  339. }
  340. }
  341. }
  342. return super.onAttack(npc, attacker, damage, isSummon);
  343. }
  344. @Override
  345. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  346. {
  347. final QuestState qs = getQuestState(killer, false);
  348. if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true))
  349. {
  350. switch (npc.getId())
  351. {
  352. case DIRE_WYRM:
  353. {
  354. if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST))
  355. {
  356. if (getQuestItemsCount(killer, DIRE_WYRM_FANG) < 20)
  357. {
  358. giveItems(killer, DIRE_WYRM_FANG, 1);
  359. if (getQuestItemsCount(killer, DIRE_WYRM_FANG) >= 20)
  360. {
  361. playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  362. }
  363. else
  364. {
  365. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  366. }
  367. }
  368. }
  369. break;
  370. }
  371. case ENCHANTED_STONE_GOLEM:
  372. {
  373. if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST))
  374. {
  375. if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) < 20)
  376. {
  377. giveItems(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE, 1);
  378. if (getQuestItemsCount(killer, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20)
  379. {
  380. playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  381. }
  382. else
  383. {
  384. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  385. }
  386. }
  387. }
  388. break;
  389. }
  390. case LETO_LIZARDMAN:
  391. case LETO_LIZARDMAN_ARCHER:
  392. case LETO_LIZARDMAN_SOLDIER:
  393. case LETO_LIZARDMAN_WARRIOR:
  394. case LETO_LIZARDMAN_SHAMAN:
  395. case LETO_LIZARDMAN_OVERLORD:
  396. {
  397. if (hasQuestItems(killer, ALEXANDRIAS_BOOK, IKERS_LIST))
  398. {
  399. if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) < 20)
  400. {
  401. giveItems(killer, LETO_LIZARDMAN_CHARM, 1);
  402. if (getQuestItemsCount(killer, LETO_LIZARDMAN_CHARM) >= 20)
  403. {
  404. playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  405. }
  406. else
  407. {
  408. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  409. }
  410. }
  411. }
  412. break;
  413. }
  414. case TAMLIN_ORC:
  415. case TAMLIN_ORC_ARCHER:
  416. {
  417. if (hasQuestItems(killer, VADINS_CRUCIFIX))
  418. {
  419. if ((getRandom(100) < 50) && (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) < 20))
  420. {
  421. giveItems(killer, TAMLIN_ORC_AMULET, 1);
  422. if (getQuestItemsCount(killer, TAMLIN_ORC_AMULET) >= 20)
  423. {
  424. playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
  425. }
  426. else
  427. {
  428. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  429. }
  430. }
  431. }
  432. break;
  433. }
  434. case NAMELESS_REVENANT:
  435. {
  436. if (hasQuestItems(killer, ALEXANDRIAS_BOOK, LARAS_MEMO) && !hasQuestItems(killer, AKLANTOTH_3RD_GEM))
  437. {
  438. takeItems(killer, LARAS_MEMO, 1);
  439. giveItems(killer, AKLANTOTH_3RD_GEM, 1);
  440. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  441. if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  442. {
  443. qs.setCond(3);
  444. }
  445. }
  446. break;
  447. }
  448. case SKELETAL_MERCENARY:
  449. {
  450. if (hasQuestItems(killer, LEOPOLDS_JOURNAL) && !hasQuestItems(killer, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  451. {
  452. if (!hasQuestItems(killer, AKLANTOTH_4TH_GEM))
  453. {
  454. giveItems(killer, AKLANTOTH_4TH_GEM, 1);
  455. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  456. }
  457. else if (!hasQuestItems(killer, AKLANTOTH_5TH_GEM))
  458. {
  459. giveItems(killer, AKLANTOTH_5TH_GEM, 1);
  460. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  461. }
  462. else if (!hasQuestItems(killer, AKLANTOTH_6TH_GEM))
  463. {
  464. takeItems(killer, LEOPOLDS_JOURNAL, 1);
  465. giveItems(killer, AKLANTOTH_6TH_GEM, 1);
  466. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  467. if (hasQuestItems(killer, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM))
  468. {
  469. qs.setCond(3);
  470. }
  471. }
  472. }
  473. break;
  474. }
  475. case DREVANUL_PRINCE_ZERUEL:
  476. {
  477. if (hasQuestItems(killer, ORIMS_INSTRUCTIONS, BRIMSTONE_2ND, SWORD_OF_BINDING, SOULTRAP_CRYSTAL))
  478. {
  479. if (npc.getKillingBlowWeapon() == SWORD_OF_BINDING)
  480. {
  481. npc.broadcastPacket(new NpcSay(npc, Say2.NPC_ALL, NpcStringId.NO_I_HAVENT_COMPLETELY_FINISHED_THE_COMMAND_FOR_DESTRUCTION_AND_SLAUGHTER_YET));
  482. takeItems(killer, SOULTRAP_CRYSTAL, 1);
  483. giveItems(killer, PURGATORY_KEY, 1);
  484. giveItems(killer, ZERUEL_BIND_CRYSTAL, 1);
  485. takeItems(killer, BRIMSTONE_2ND, 1);
  486. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  487. qs.setCond(10);
  488. }
  489. }
  490. break;
  491. }
  492. }
  493. }
  494. return super.onKill(npc, killer, isSummon);
  495. }
  496. @Override
  497. public String onTalk(L2Npc npc, L2PcInstance player)
  498. {
  499. final QuestState qs = getQuestState(player, true);
  500. String htmltext = getNoQuestMsg(player);
  501. if (qs.isCreated())
  502. {
  503. if (npc.getId() == SHADOW_ORIM)
  504. {
  505. if ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.knight) || (player.getClassId() == ClassId.palusKnight))
  506. {
  507. if (player.getLevel() >= MIN_LEVEL)
  508. {
  509. if (player.getClassId() == ClassId.wizard)
  510. {
  511. htmltext = "30630-03.htm";
  512. }
  513. else
  514. {
  515. htmltext = "30630-05.htm";
  516. }
  517. }
  518. else
  519. {
  520. htmltext = "30630-02.htm";
  521. }
  522. }
  523. else
  524. {
  525. htmltext = "30630-01.htm";
  526. }
  527. }
  528. }
  529. else if (qs.isStarted())
  530. {
  531. switch (npc.getId())
  532. {
  533. case SHADOW_ORIM:
  534. {
  535. if (hasQuestItems(player, ORIMS_DIAGRAM))
  536. {
  537. htmltext = "30630-09.htm";
  538. }
  539. else if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  540. {
  541. if (hasQuestItems(player, AKLANTOTH_1ST_GEM, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  542. {
  543. htmltext = "30630-11.htm";
  544. }
  545. else
  546. {
  547. htmltext = "30630-10.htm";
  548. }
  549. }
  550. else if (hasQuestItems(player, BRIMSTONE_1ST))
  551. {
  552. htmltext = "30630-15.htm";
  553. }
  554. else if (hasQuestItems(player, ORIMS_INSTRUCTIONS) && !hasAtLeastOneQuestItem(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL))
  555. {
  556. htmltext = "30630-17.htm";
  557. }
  558. if (hasQuestItems(player, SWORD_OF_BINDING, SOULTRAP_CRYSTAL))
  559. {
  560. qs.setCond(8, true);
  561. htmltext = "30630-18.htm";
  562. }
  563. else if (hasQuestItems(player, SWORD_OF_BINDING, ZERUEL_BIND_CRYSTAL))
  564. {
  565. htmltext = "30630-19.htm";
  566. }
  567. break;
  568. }
  569. case GROCER_LARA:
  570. {
  571. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  572. {
  573. if (!hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM))
  574. {
  575. htmltext = "30063-01.htm";
  576. }
  577. else if (!hasQuestItems(player, AKLANTOTH_3RD_GEM) && hasQuestItems(player, LARAS_MEMO))
  578. {
  579. htmltext = "30063-03.htm";
  580. }
  581. else if (!hasQuestItems(player, LARAS_MEMO) && hasQuestItems(player, AKLANTOTH_3RD_GEM))
  582. {
  583. htmltext = "30063-04.htm";
  584. }
  585. }
  586. else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS))
  587. {
  588. htmltext = "30063-05.htm";
  589. }
  590. break;
  591. }
  592. case TRADER_ALEXANDRIA:
  593. {
  594. if (hasQuestItems(player, ORIMS_DIAGRAM))
  595. {
  596. htmltext = "30098-01.htm";
  597. }
  598. else if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  599. {
  600. htmltext = "30098-04.htm";
  601. }
  602. else if (hasQuestItems(player, ORIMS_INSTRUCTIONS, BRIMSTONE_1ST))
  603. {
  604. htmltext = "30098-05.htm";
  605. }
  606. break;
  607. }
  608. case MAGISTER_IKER:
  609. {
  610. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  611. {
  612. if (!hasAtLeastOneQuestItem(player, IKERS_LIST, AKLANTOTH_1ST_GEM))
  613. {
  614. htmltext = "30110-01.htm";
  615. }
  616. else if (hasQuestItems(player, IKERS_LIST))
  617. {
  618. if ((getQuestItemsCount(player, DIRE_WYRM_FANG) >= 20) && (getQuestItemsCount(player, LETO_LIZARDMAN_CHARM) >= 20) && (getQuestItemsCount(player, ENCHANTED_STONE_GOLEM_HEARTSTONE) >= 20))
  619. {
  620. takeItems(player, IKERS_LIST, 1);
  621. takeItems(player, DIRE_WYRM_FANG, -1);
  622. takeItems(player, LETO_LIZARDMAN_CHARM, -1);
  623. takeItems(player, ENCHANTED_STONE_GOLEM_HEARTSTONE, -1);
  624. giveItems(player, AKLANTOTH_1ST_GEM, 1);
  625. if (hasQuestItems(player, AKLANTOTH_2ND_GEM, AKLANTOTH_3RD_GEM, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  626. {
  627. qs.setCond(3, true);
  628. }
  629. htmltext = "30110-05.htm";
  630. }
  631. else
  632. {
  633. htmltext = "30110-04.htm";
  634. }
  635. }
  636. else if (!hasQuestItems(player, IKERS_LIST) && hasQuestItems(player, AKLANTOTH_1ST_GEM))
  637. {
  638. htmltext = "30110-06.htm";
  639. }
  640. }
  641. else if (hasQuestItems(player, ORIMS_INSTRUCTIONS))
  642. {
  643. if (!hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, ZERUEL_BIND_CRYSTAL))
  644. {
  645. htmltext = "30110-07.htm";
  646. }
  647. else if (!hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && hasQuestItems(player, SOULTRAP_CRYSTAL))
  648. {
  649. htmltext = "30110-09.htm";
  650. }
  651. else if (!hasQuestItems(player, SOULTRAP_CRYSTAL) && hasQuestItems(player, ZERUEL_BIND_CRYSTAL))
  652. {
  653. htmltext = "30110-10.htm";
  654. }
  655. }
  656. break;
  657. }
  658. case PRIEST_VADIN:
  659. {
  660. if (hasQuestItems(player, ORIMS_INSTRUCTIONS, SIR_VASPERS_LETTER))
  661. {
  662. takeItems(player, SIR_VASPERS_LETTER, 1);
  663. giveItems(player, VADINS_CRUCIFIX, 1);
  664. htmltext = "30188-01.htm";
  665. }
  666. else if (hasQuestItems(player, VADINS_CRUCIFIX))
  667. {
  668. if (getQuestItemsCount(player, TAMLIN_ORC_AMULET) < 20)
  669. {
  670. htmltext = "30188-02.htm";
  671. }
  672. else
  673. {
  674. takeItems(player, VADINS_CRUCIFIX, 1);
  675. takeItems(player, TAMLIN_ORC_AMULET, -1);
  676. giveItems(player, VADINS_SANCTIONS, 1);
  677. htmltext = "30188-03.htm";
  678. }
  679. }
  680. else if (hasQuestItems(player, ORIMS_INSTRUCTIONS))
  681. {
  682. if (hasQuestItems(player, VADINS_SANCTIONS))
  683. {
  684. htmltext = "30188-04.htm";
  685. }
  686. else if (hasQuestItems(player, SWORD_OF_BINDING))
  687. {
  688. htmltext = "30188-05.htm";
  689. }
  690. }
  691. break;
  692. }
  693. case TRADER_NESTLE:
  694. {
  695. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  696. {
  697. if (!hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, NESTLES_MEMO, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  698. {
  699. htmltext = "30314-01.htm";
  700. }
  701. else if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL))
  702. {
  703. htmltext = "30314-03.htm";
  704. }
  705. else if (!hasQuestItems(player, NESTLES_MEMO) && hasAtLeastOneQuestItem(player, LEOPOLDS_JOURNAL, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  706. {
  707. htmltext = "30314-04.htm";
  708. }
  709. }
  710. break;
  711. }
  712. case SIR_KLAUS_VASPER:
  713. {
  714. if (hasQuestItems(player, ORIMS_INSTRUCTIONS))
  715. {
  716. if (hasQuestItems(player, ORIMS_1ST_LETTER))
  717. {
  718. htmltext = "30417-01.htm";
  719. }
  720. else if (hasQuestItems(player, SIR_VASPERS_LETTER))
  721. {
  722. htmltext = "30417-04.htm";
  723. }
  724. else if (hasQuestItems(player, VADINS_SANCTIONS))
  725. {
  726. giveItems(player, SWORD_OF_BINDING, 1);
  727. takeItems(player, VADINS_SANCTIONS, 1);
  728. if (hasQuestItems(player, SOULTRAP_CRYSTAL))
  729. {
  730. qs.setCond(7, true);
  731. }
  732. htmltext = "30417-05.htm";
  733. }
  734. else if (hasQuestItems(player, SWORD_OF_BINDING))
  735. {
  736. htmltext = "30417-06.htm";
  737. }
  738. }
  739. break;
  740. }
  741. case LEOPOLD:
  742. {
  743. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  744. {
  745. if (hasQuestItems(player, NESTLES_MEMO) && !hasQuestItems(player, LEOPOLDS_JOURNAL))
  746. {
  747. htmltext = "30435-01.htm";
  748. }
  749. else if (hasQuestItems(player, LEOPOLDS_JOURNAL) && !hasQuestItems(player, NESTLES_MEMO))
  750. {
  751. htmltext = "30435-03.htm";
  752. }
  753. else if (hasQuestItems(player, AKLANTOTH_4TH_GEM, AKLANTOTH_5TH_GEM, AKLANTOTH_6TH_GEM))
  754. {
  755. htmltext = "30435-04.htm";
  756. }
  757. }
  758. else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS))
  759. {
  760. htmltext = "30435-05.htm";
  761. }
  762. break;
  763. }
  764. case MAGISTER_KAIRA:
  765. {
  766. if (hasQuestItems(player, ALEXANDRIAS_BOOK))
  767. {
  768. if (!hasQuestItems(player, AKLANTOTH_2ND_GEM))
  769. {
  770. htmltext = "30476-01.htm";
  771. }
  772. else
  773. {
  774. htmltext = "30476-03.htm";
  775. }
  776. }
  777. else if (hasAtLeastOneQuestItem(player, BRIMSTONE_1ST, ORIMS_INSTRUCTIONS))
  778. {
  779. htmltext = "30476-04.htm";
  780. }
  781. break;
  782. }
  783. case WARDEN_RODERIK:
  784. {
  785. if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM))
  786. {
  787. htmltext = "30631-01.htm";
  788. }
  789. break;
  790. }
  791. case WARDEN_ENDRIGO:
  792. {
  793. if (hasQuestItems(player, ALEXANDRIAS_BOOK) && hasAtLeastOneQuestItem(player, LARAS_MEMO, AKLANTOTH_3RD_GEM))
  794. {
  795. htmltext = "30632-01.htm";
  796. }
  797. break;
  798. }
  799. case FISHER_EVERT:
  800. {
  801. if (hasQuestItems(player, ORIMS_INSTRUCTIONS))
  802. {
  803. if (hasQuestItems(player, SOULTRAP_CRYSTAL, SWORD_OF_BINDING) && !hasQuestItems(player, BRIMSTONE_2ND))
  804. {
  805. htmltext = "30633-01.htm";
  806. }
  807. else if (hasQuestItems(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND) && !hasQuestItems(player, ZERUEL_BIND_CRYSTAL))
  808. {
  809. if (npc.getSummonedNpcCount() < 1)
  810. {
  811. addSpawn(npc, DREVANUL_PRINCE_ZERUEL, DREVANUL_PRINCE_ZERUEL_SPAWN, false, 0);
  812. }
  813. htmltext = "30633-02.htm";
  814. }
  815. else if (hasQuestItems(player, ZERUEL_BIND_CRYSTAL) && !hasAtLeastOneQuestItem(player, SOULTRAP_CRYSTAL, BRIMSTONE_2ND))
  816. {
  817. htmltext = "30633-03.htm";
  818. }
  819. }
  820. break;
  821. }
  822. }
  823. }
  824. else if (qs.isCompleted())
  825. {
  826. if (npc.getId() == SHADOW_ORIM)
  827. {
  828. htmltext = getAlreadyCompletedMsg(player);
  829. }
  830. }
  831. return htmltext;
  832. }
  833. private boolean checkWeapon(L2PcInstance player)
  834. {
  835. L2ItemInstance weapon = player.getActiveWeaponInstance();
  836. return ((weapon != null) && ((weapon.getId() == SWORD_OF_BINDING)));
  837. }
  838. }