Q00413_PathOfTheShillienOracle.java 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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.Q00413_PathOfTheShillienOracle;
  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. * Path Of The Shillien Oracle (413)
  30. * @author ivantotov
  31. */
  32. public final class Q00413_PathOfTheShillienOracle extends Quest
  33. {
  34. // NPCs
  35. private static final int MAGISTER_SIDRA = 30330;
  36. private static final int PRIEST_ADONIUS = 30375;
  37. private static final int MAGISTER_TALBOT = 30377;
  38. // Items
  39. private static final int SIDRAS_LETTER = 1262;
  40. private static final int BLANK_SHEET = 1263;
  41. private static final int BLOODY_RUNE = 1264;
  42. private static final int GARMIELS_BOOK = 1265;
  43. private static final int PRAYER_OF_ADONIUS = 1266;
  44. private static final int PENITENTS_MARK = 1267;
  45. private static final int ASHEN_BONES = 1268;
  46. private static final int ANDARIEL_BOOK = 1269;
  47. // Reward
  48. private static final int ORB_OF_ABYSS = 1270;
  49. // Monster
  50. private static final int ZOMBIE_SOLDIER = 20457;
  51. private static final int ZOMBIE_WARRIOR = 20458;
  52. private static final int SHIELD_SKELETON = 20514;
  53. private static final int SKELETON_INFANTRYMAN = 20515;
  54. private static final int DARK_SUCCUBUS = 20776;
  55. // Misc
  56. private static final int MIN_LEVEL = 18;
  57. public Q00413_PathOfTheShillienOracle()
  58. {
  59. super(413, Q00413_PathOfTheShillienOracle.class.getSimpleName(), "Path of the Shillien Oracle");
  60. addStartNpc(MAGISTER_SIDRA);
  61. addTalkId(MAGISTER_SIDRA, PRIEST_ADONIUS, MAGISTER_TALBOT);
  62. addKillId(ZOMBIE_SOLDIER, ZOMBIE_WARRIOR, SHIELD_SKELETON, SKELETON_INFANTRYMAN, DARK_SUCCUBUS);
  63. registerQuestItems(SIDRAS_LETTER, BLANK_SHEET, BLOODY_RUNE, GARMIELS_BOOK, PRAYER_OF_ADONIUS, PENITENTS_MARK, ASHEN_BONES, ANDARIEL_BOOK);
  64. }
  65. @Override
  66. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  67. {
  68. final QuestState qs = getQuestState(player, false);
  69. if (qs == null)
  70. {
  71. return null;
  72. }
  73. String htmltext = null;
  74. switch (event)
  75. {
  76. case "ACCEPT":
  77. {
  78. if (player.getClassId() == ClassId.darkMage)
  79. {
  80. if (player.getLevel() >= MIN_LEVEL)
  81. {
  82. if (hasQuestItems(player, ORB_OF_ABYSS))
  83. {
  84. htmltext = "30330-04.htm";
  85. }
  86. else
  87. {
  88. htmltext = "30330-05.htm";
  89. }
  90. }
  91. else
  92. {
  93. htmltext = "30330-02.htm";
  94. }
  95. }
  96. else if (player.getClassId() == ClassId.shillienOracle)
  97. {
  98. htmltext = "30330-02a.htm";
  99. }
  100. else
  101. {
  102. htmltext = "30330-03.htm";
  103. }
  104. break;
  105. }
  106. case "30330-06.htm":
  107. {
  108. if (!hasQuestItems(player, SIDRAS_LETTER))
  109. {
  110. giveItems(player, SIDRAS_LETTER, 1);
  111. }
  112. qs.startQuest();
  113. htmltext = event;
  114. break;
  115. }
  116. case "30330-06a.html":
  117. case "30375-02.html":
  118. case "30375-03.html":
  119. {
  120. htmltext = event;
  121. break;
  122. }
  123. case "30375-04.html":
  124. {
  125. if (hasQuestItems(player, PRAYER_OF_ADONIUS))
  126. {
  127. takeItems(player, PRAYER_OF_ADONIUS, 1);
  128. giveItems(player, PENITENTS_MARK, 1);
  129. qs.setCond(5, true);
  130. }
  131. htmltext = event;
  132. break;
  133. }
  134. case "30377-02.html":
  135. {
  136. if (hasQuestItems(player, SIDRAS_LETTER))
  137. {
  138. takeItems(player, SIDRAS_LETTER, 1);
  139. giveItems(player, BLANK_SHEET, 5);
  140. qs.setCond(2, true);
  141. }
  142. htmltext = event;
  143. break;
  144. }
  145. }
  146. return htmltext;
  147. }
  148. @Override
  149. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  150. {
  151. final QuestState qs = getQuestState(killer, false);
  152. if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true))
  153. {
  154. switch (npc.getId())
  155. {
  156. case ZOMBIE_SOLDIER:
  157. case ZOMBIE_WARRIOR:
  158. case SHIELD_SKELETON:
  159. case SKELETON_INFANTRYMAN:
  160. {
  161. if (hasQuestItems(killer, PENITENTS_MARK) && (getQuestItemsCount(killer, ASHEN_BONES) < 10))
  162. {
  163. giveItems(killer, ASHEN_BONES, 1);
  164. if (getQuestItemsCount(killer, ASHEN_BONES) == 10)
  165. {
  166. qs.setCond(6, true);
  167. }
  168. else
  169. {
  170. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  171. }
  172. }
  173. break;
  174. }
  175. case DARK_SUCCUBUS:
  176. {
  177. if (hasQuestItems(killer, BLANK_SHEET))
  178. {
  179. giveItems(killer, BLOODY_RUNE, 1);
  180. takeItems(killer, BLANK_SHEET, 1);
  181. if (!hasQuestItems(killer, BLANK_SHEET) && (getQuestItemsCount(killer, BLOODY_RUNE) == 5))
  182. {
  183. qs.setCond(3, true);
  184. }
  185. else
  186. {
  187. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  188. }
  189. }
  190. break;
  191. }
  192. }
  193. }
  194. return super.onKill(npc, killer, isSummon);
  195. }
  196. @Override
  197. public String onTalk(L2Npc npc, L2PcInstance player)
  198. {
  199. final QuestState qs = getQuestState(player, true);
  200. String htmltext = getNoQuestMsg(player);
  201. if (qs.isCreated() || qs.isCompleted())
  202. {
  203. if (npc.getId() == MAGISTER_SIDRA)
  204. {
  205. htmltext = "30330-01.htm";
  206. }
  207. }
  208. else if (qs.isStarted())
  209. {
  210. switch (npc.getId())
  211. {
  212. case MAGISTER_SIDRA:
  213. {
  214. if (hasQuestItems(player, SIDRAS_LETTER))
  215. {
  216. htmltext = "30330-07.html";
  217. }
  218. else if (hasAtLeastOneQuestItem(player, BLANK_SHEET, BLOODY_RUNE))
  219. {
  220. htmltext = "30330-08.html";
  221. }
  222. else if (!hasQuestItems(player, ANDARIEL_BOOK) && hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, GARMIELS_BOOK, PENITENTS_MARK, ASHEN_BONES))
  223. {
  224. htmltext = "30330-09.html";
  225. }
  226. else if (hasAtLeastOneQuestItem(player, ANDARIEL_BOOK, GARMIELS_BOOK))
  227. {
  228. giveAdena(player, 163800, true);
  229. giveItems(player, ORB_OF_ABYSS, 1);
  230. final int level = player.getLevel();
  231. if (level >= 20)
  232. {
  233. addExpAndSp(player, 320534, 26532);
  234. }
  235. else if (level == 19)
  236. {
  237. addExpAndSp(player, 456128, 33230);
  238. }
  239. else
  240. {
  241. addExpAndSp(player, 591724, 39928);
  242. }
  243. qs.exitQuest(false, true);
  244. player.sendPacket(new SocialAction(player.getObjectId(), 3));
  245. qs.saveGlobalQuestVar("1ClassQuestFinished", "1");
  246. htmltext = "30330-10.html";
  247. }
  248. break;
  249. }
  250. case PRIEST_ADONIUS:
  251. {
  252. if (hasQuestItems(player, PRAYER_OF_ADONIUS))
  253. {
  254. htmltext = "30375-01.html";
  255. }
  256. else if (hasQuestItems(player, PENITENTS_MARK) && !hasAtLeastOneQuestItem(player, ASHEN_BONES, ANDARIEL_BOOK))
  257. {
  258. htmltext = "30375-05.html";
  259. }
  260. else if (hasQuestItems(player, PENITENTS_MARK))
  261. {
  262. if (hasQuestItems(player, ASHEN_BONES) && (getQuestItemsCount(player, ASHEN_BONES) < 10))
  263. {
  264. htmltext = "30375-06.html";
  265. }
  266. else
  267. {
  268. takeItems(player, PENITENTS_MARK, 1);
  269. takeItems(player, ASHEN_BONES, -1);
  270. giveItems(player, ANDARIEL_BOOK, 1);
  271. qs.setCond(7, true);
  272. htmltext = "30375-07.html";
  273. }
  274. }
  275. else if (hasQuestItems(player, ANDARIEL_BOOK))
  276. {
  277. htmltext = "30375-08.html";
  278. }
  279. break;
  280. }
  281. case MAGISTER_TALBOT:
  282. {
  283. if (hasQuestItems(player, SIDRAS_LETTER))
  284. {
  285. htmltext = "30377-01.html";
  286. }
  287. else if (!hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLANK_SHEET) == 5))
  288. {
  289. htmltext = "30377-03.html";
  290. }
  291. else if (hasQuestItems(player, BLOODY_RUNE) && (getQuestItemsCount(player, BLOODY_RUNE) < 5))
  292. {
  293. htmltext = "30377-04.html";
  294. }
  295. else if (getQuestItemsCount(player, BLOODY_RUNE) >= 5)
  296. {
  297. takeItems(player, BLOODY_RUNE, -1);
  298. giveItems(player, GARMIELS_BOOK, 1);
  299. giveItems(player, PRAYER_OF_ADONIUS, 1);
  300. qs.setCond(4, true);
  301. htmltext = "30377-05.html";
  302. }
  303. else if (hasAtLeastOneQuestItem(player, PRAYER_OF_ADONIUS, PENITENTS_MARK, ASHEN_BONES))
  304. {
  305. htmltext = "30377-06.html";
  306. }
  307. else if (hasQuestItems(player, ANDARIEL_BOOK, GARMIELS_BOOK))
  308. {
  309. htmltext = "30377-07.html";
  310. }
  311. break;
  312. }
  313. }
  314. }
  315. return htmltext;
  316. }
  317. }