Q00138_TempleChampionPart2.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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.Q00138_TempleChampionPart2;
  20. import quests.Q00137_TempleChampionPart1.Q00137_TempleChampionPart1;
  21. import com.l2jserver.gameserver.enums.QuestSound;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. /**
  27. * Temple Champion - 2 (138)
  28. * @author nonom
  29. */
  30. public class Q00138_TempleChampionPart2 extends Quest
  31. {
  32. // NPCs
  33. private static final int SYLVAIN = 30070;
  34. private static final int PUPINA = 30118;
  35. private static final int ANGUS = 30474;
  36. private static final int SLA = 30666;
  37. private static final int MOBS[] =
  38. {
  39. 20176, // Wyrm
  40. 20550, // Guardian Basilisk
  41. 20551, // Road Scavenger
  42. 20552, // Fettered Soul
  43. };
  44. // Items
  45. private static final int TEMPLE_MANIFESTO = 10341;
  46. private static final int RELICS_OF_THE_DARK_ELF_TRAINEE = 10342;
  47. private static final int ANGUS_RECOMMENDATION = 10343;
  48. private static final int PUPINAS_RECOMMENDATION = 10344;
  49. public Q00138_TempleChampionPart2()
  50. {
  51. super(138, Q00138_TempleChampionPart2.class.getSimpleName(), "Temple Champion - 2");
  52. addStartNpc(SYLVAIN);
  53. addTalkId(SYLVAIN, PUPINA, ANGUS, SLA);
  54. addKillId(MOBS);
  55. registerQuestItems(TEMPLE_MANIFESTO, RELICS_OF_THE_DARK_ELF_TRAINEE, ANGUS_RECOMMENDATION, PUPINAS_RECOMMENDATION);
  56. }
  57. @Override
  58. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  59. {
  60. final QuestState st = getQuestState(player, false);
  61. if (st == null)
  62. {
  63. return getNoQuestMsg(player);
  64. }
  65. switch (event)
  66. {
  67. case "30070-02.htm":
  68. st.startQuest();
  69. st.giveItems(TEMPLE_MANIFESTO, 1);
  70. break;
  71. case "30070-05.html":
  72. st.giveAdena(84593, true);
  73. if ((player.getLevel() < 42))
  74. {
  75. st.addExpAndSp(187062, 11307);
  76. }
  77. st.exitQuest(false, true);
  78. break;
  79. case "30070-03.html":
  80. st.setCond(2, true);
  81. break;
  82. case "30118-06.html":
  83. st.setCond(3, true);
  84. break;
  85. case "30118-09.html":
  86. st.setCond(6, true);
  87. st.giveItems(PUPINAS_RECOMMENDATION, 1);
  88. break;
  89. case "30474-02.html":
  90. st.setCond(4, true);
  91. break;
  92. case "30666-02.html":
  93. if (st.hasQuestItems(PUPINAS_RECOMMENDATION))
  94. {
  95. st.set("talk", "1");
  96. st.takeItems(PUPINAS_RECOMMENDATION, -1);
  97. }
  98. break;
  99. case "30666-03.html":
  100. if (st.hasQuestItems(TEMPLE_MANIFESTO))
  101. {
  102. st.set("talk", "2");
  103. st.takeItems(TEMPLE_MANIFESTO, -1);
  104. }
  105. break;
  106. case "30666-08.html":
  107. st.setCond(7, true);
  108. st.unset("talk");
  109. break;
  110. }
  111. return event;
  112. }
  113. @Override
  114. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  115. {
  116. final QuestState st = getQuestState(player, false);
  117. if ((st != null) && st.isStarted() && st.isCond(4) && (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) < 10))
  118. {
  119. st.giveItems(RELICS_OF_THE_DARK_ELF_TRAINEE, 1);
  120. if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10)
  121. {
  122. st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
  123. }
  124. else
  125. {
  126. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  127. }
  128. }
  129. return super.onKill(npc, player, isSummon);
  130. }
  131. @Override
  132. public String onTalk(L2Npc npc, L2PcInstance player)
  133. {
  134. String htmltext = getNoQuestMsg(player);
  135. final QuestState st = getQuestState(player, true);
  136. if (st == null)
  137. {
  138. return htmltext;
  139. }
  140. switch (npc.getId())
  141. {
  142. case SYLVAIN:
  143. switch (st.getCond())
  144. {
  145. case 1:
  146. htmltext = "30070-02.htm";
  147. break;
  148. case 2:
  149. case 3:
  150. case 4:
  151. case 5:
  152. case 6:
  153. htmltext = "30070-03.html";
  154. break;
  155. case 7:
  156. htmltext = "30070-04.html";
  157. break;
  158. default:
  159. if (st.isCompleted())
  160. {
  161. return getAlreadyCompletedMsg(player);
  162. }
  163. final QuestState qs = player.getQuestState(Q00137_TempleChampionPart1.class.getSimpleName());
  164. htmltext = (player.getLevel() >= 36) ? ((qs != null) && qs.isCompleted()) ? "30070-01.htm" : "30070-00a.htm" : "30070-00.htm";
  165. break;
  166. }
  167. break;
  168. case PUPINA:
  169. switch (st.getCond())
  170. {
  171. case 2:
  172. htmltext = "30118-01.html";
  173. break;
  174. case 3:
  175. case 4:
  176. htmltext = "30118-07.html";
  177. break;
  178. case 5:
  179. htmltext = "30118-08.html";
  180. if (st.hasQuestItems(ANGUS_RECOMMENDATION))
  181. {
  182. st.takeItems(ANGUS_RECOMMENDATION, -1);
  183. }
  184. break;
  185. case 6:
  186. htmltext = "30118-10.html";
  187. break;
  188. }
  189. break;
  190. case ANGUS:
  191. switch (st.getCond())
  192. {
  193. case 3:
  194. htmltext = "30474-01.html";
  195. break;
  196. case 4:
  197. if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10)
  198. {
  199. st.takeItems(RELICS_OF_THE_DARK_ELF_TRAINEE, -1);
  200. st.giveItems(ANGUS_RECOMMENDATION, 1);
  201. st.setCond(5, true);
  202. htmltext = "30474-04.html";
  203. }
  204. else
  205. {
  206. htmltext = "30474-03.html";
  207. }
  208. break;
  209. case 5:
  210. htmltext = "30474-05.html";
  211. break;
  212. }
  213. break;
  214. case SLA:
  215. switch (st.getCond())
  216. {
  217. case 6:
  218. switch (st.getInt("talk"))
  219. {
  220. case 1:
  221. htmltext = "30666-02.html";
  222. break;
  223. case 2:
  224. htmltext = "30666-03.html";
  225. break;
  226. default:
  227. htmltext = "30666-01.html";
  228. break;
  229. }
  230. break;
  231. case 7:
  232. htmltext = "30666-09.html";
  233. break;
  234. }
  235. break;
  236. }
  237. return htmltext;
  238. }
  239. }