Q00237_WindsOfChange.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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.Q00237_WindsOfChange;
  20. import quests.Q00238_SuccessFailureOfBusiness.Q00238_SuccessFailureOfBusiness;
  21. import quests.Q00239_WontYouJoinUs.Q00239_WontYouJoinUs;
  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. import com.l2jserver.gameserver.model.quest.State;
  27. /**
  28. * Winds of Change (237)<br>
  29. * Original Jython script by Bloodshed.
  30. * @author Joxit
  31. */
  32. public class Q00237_WindsOfChange extends Quest
  33. {
  34. // NPCs
  35. private static final int FLAUEN = 30899;
  36. private static final int IASON = 30969;
  37. private static final int ROMAN = 30897;
  38. private static final int MORELYN = 30925;
  39. private static final int HELVETICA = 32641;
  40. private static final int ATHENIA = 32643;
  41. // Items
  42. private static final int FLAUENS_LETTER = 14862;
  43. private static final int DOSKOZER_LETTER = 14863;
  44. private static final int ATHENIA_LETTER = 14864;
  45. private static final int VICINITY_OF_FOS = 14865;
  46. private static final int SUPPORT_CERTIFICATE = 14866;
  47. // Misc
  48. private static final int MIN_LEVEL = 82;
  49. public Q00237_WindsOfChange()
  50. {
  51. super(237, Q00237_WindsOfChange.class.getSimpleName(), "Winds of Change");
  52. addStartNpc(FLAUEN);
  53. addTalkId(FLAUEN, IASON, ROMAN, MORELYN, HELVETICA, ATHENIA);
  54. registerQuestItems(FLAUENS_LETTER, DOSKOZER_LETTER, ATHENIA_LETTER);
  55. }
  56. @Override
  57. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  58. {
  59. final QuestState st = getQuestState(player, false);
  60. if (st == null)
  61. {
  62. return null;
  63. }
  64. String htmltext = null;
  65. switch (event)
  66. {
  67. case "30899-02.htm":// FLAUEN
  68. case "30899-03.htm":
  69. case "30899-04.htm":
  70. case "30899-05.htm":
  71. case "30969-03.html":// IASON
  72. case "30969-03a.html":
  73. case "30969-03b.html":
  74. case "30969-04.html":
  75. case "30969-08.html":
  76. case "30969-08a.html":
  77. case "30969-08b.html":
  78. case "30969-08c.html":
  79. case "30897-02.html":// ROMAN
  80. case "30925-02.html":// MORELYN
  81. htmltext = event;
  82. break;
  83. case "30899-06.html":
  84. st.startQuest();
  85. st.giveItems(FLAUENS_LETTER, 1);
  86. htmltext = event;
  87. break;
  88. case "30969-02.html":
  89. st.takeItems(FLAUENS_LETTER, -1);
  90. htmltext = event;
  91. break;
  92. case "30969-05.html":
  93. if (st.isCond(1))
  94. {
  95. st.setCond(2, true);
  96. htmltext = event;
  97. }
  98. break;
  99. case "30897-03.html":
  100. if (st.isCond(2))
  101. {
  102. st.setCond(3, true);
  103. htmltext = event;
  104. }
  105. break;
  106. case "30925-03.html":
  107. if (st.isCond(3))
  108. {
  109. st.setCond(4, true);
  110. htmltext = event;
  111. }
  112. break;
  113. case "30969-09.html":
  114. if (st.isCond(4))
  115. {
  116. st.giveItems(DOSKOZER_LETTER, 1);
  117. st.setCond(5, true);
  118. htmltext = event;
  119. }
  120. break;
  121. case "30969-10.html":
  122. if (st.isCond(4))
  123. {
  124. st.giveItems(ATHENIA_LETTER, 1);
  125. st.setCond(6, true);
  126. htmltext = event;
  127. }
  128. break;
  129. case "32641-02.html":
  130. st.giveAdena(213876, true);
  131. st.giveItems(VICINITY_OF_FOS, 1);
  132. st.addExpAndSp(892773, 60012);
  133. st.exitQuest(false, true);
  134. htmltext = event;
  135. break;
  136. case "32643-02.html":
  137. st.giveAdena(213876, true);
  138. st.giveItems(SUPPORT_CERTIFICATE, 1);
  139. st.addExpAndSp(892773, 60012);
  140. st.exitQuest(false, true);
  141. htmltext = event;
  142. break;
  143. }
  144. return htmltext;
  145. }
  146. @Override
  147. public String onTalk(L2Npc npc, L2PcInstance talker)
  148. {
  149. String htmltext = getNoQuestMsg(talker);
  150. final QuestState st = getQuestState(talker, true);
  151. if (st == null)
  152. {
  153. return htmltext;
  154. }
  155. switch (npc.getId())
  156. {
  157. case FLAUEN:
  158. switch (st.getState())
  159. {
  160. case State.COMPLETED:
  161. htmltext = "30899-09.html";
  162. break;
  163. case State.CREATED:
  164. htmltext = (talker.getLevel() >= MIN_LEVEL) ? "30899-01.htm" : "30899-00.html";
  165. break;
  166. case State.STARTED:
  167. switch (st.getCond())
  168. {
  169. case 1:
  170. case 4:
  171. htmltext = "30899-07.html";
  172. break;
  173. case 2:
  174. htmltext = "30899-10.html";
  175. break;
  176. case 3:
  177. htmltext = "30899-11.html";
  178. break;
  179. case 5:
  180. case 6:
  181. htmltext = "30899-08.html";
  182. break;
  183. }
  184. }
  185. break;
  186. case IASON:
  187. if (st.isCompleted())
  188. {
  189. htmltext = Quest.getNoQuestMsg(talker);
  190. }
  191. else
  192. {
  193. switch (st.getCond())
  194. {
  195. case 1:
  196. htmltext = "30969-01.html";
  197. break;
  198. case 2:
  199. htmltext = "30969-06.html";
  200. break;
  201. case 4:
  202. htmltext = "30969-07.html";
  203. break;
  204. case 5:
  205. case 6:
  206. htmltext = "30969-11.html";
  207. break;
  208. }
  209. }
  210. break;
  211. case ROMAN:
  212. switch (st.getCond())
  213. {
  214. case 2:
  215. htmltext = "30897-01.html";
  216. break;
  217. case 3:
  218. case 4:
  219. htmltext = "30897-04.html";
  220. break;
  221. }
  222. break;
  223. case MORELYN:
  224. switch (st.getCond())
  225. {
  226. case 3:
  227. htmltext = "30925-01.html";
  228. break;
  229. case 4:
  230. htmltext = "30925-04.html";
  231. break;
  232. }
  233. break;
  234. case HELVETICA:
  235. if (st.isCompleted())
  236. {
  237. final QuestState q238 = st.getPlayer().getQuestState(Q00238_SuccessFailureOfBusiness.class.getSimpleName());
  238. htmltext = (st.hasQuestItems(VICINITY_OF_FOS) || ((q238 != null) && q238.isCompleted())) ? "32641-03.html" : "32641-05.html";
  239. }
  240. else if (st.isCond(5))
  241. {
  242. htmltext = "32641-01.html";
  243. }
  244. else if (st.isCond(6))
  245. {
  246. htmltext = "32641-04.html";
  247. }
  248. break;
  249. case ATHENIA:
  250. if (st.isCompleted())
  251. {
  252. final QuestState q239 = st.getPlayer().getQuestState(Q00239_WontYouJoinUs.class.getSimpleName());
  253. htmltext = (st.hasQuestItems(SUPPORT_CERTIFICATE) || ((q239 != null) && q239.isCompleted())) ? "32643-03.html" : "32643-05.html";
  254. }
  255. else if (st.isCond(5))
  256. {
  257. htmltext = "32643-04.html";
  258. }
  259. else if (st.isCond(6))
  260. {
  261. htmltext = "32643-01.html";
  262. }
  263. break;
  264. }
  265. return htmltext;
  266. }
  267. }