Q00411_PathOfTheAssassin.java 10 KB

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