Q10286_ReunionWithSirra.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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.Q10286_ReunionWithSirra;
  20. import quests.Q10285_MeetingSirra.Q10285_MeetingSirra;
  21. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  22. import com.l2jserver.gameserver.model.Location;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
  26. import com.l2jserver.gameserver.model.quest.Quest;
  27. import com.l2jserver.gameserver.model.quest.QuestState;
  28. import com.l2jserver.gameserver.model.quest.State;
  29. import com.l2jserver.gameserver.network.NpcStringId;
  30. import com.l2jserver.gameserver.network.clientpackets.Say2;
  31. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  32. /**
  33. * Reunion with Sirra (10286)
  34. * @author Adry_85
  35. */
  36. public final class Q10286_ReunionWithSirra extends Quest
  37. {
  38. // NPCs
  39. private static final int RAFFORTY = 32020;
  40. private static final int JINIA = 32760;
  41. private static final int SIRRA = 32762;
  42. private static final int JINIA2 = 32781;
  43. // Item
  44. private static final int BLACK_FROZEN_CORE = 15470;
  45. // Misc
  46. private static final int MIN_LEVEL = 82;
  47. // Location
  48. private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0);
  49. public Q10286_ReunionWithSirra()
  50. {
  51. super(10286, Q10286_ReunionWithSirra.class.getSimpleName(), "Reunion with Sirra");
  52. addStartNpc(RAFFORTY);
  53. addTalkId(RAFFORTY, JINIA, SIRRA, JINIA2);
  54. registerQuestItems(BLACK_FROZEN_CORE);
  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 "32020-02.htm":
  68. {
  69. st.startQuest();
  70. st.setMemoState(1);
  71. htmltext = event;
  72. break;
  73. }
  74. case "32020-03.html":
  75. case "32760-02.html":
  76. case "32760-03.html":
  77. case "32760-04.html":
  78. {
  79. if (st.isMemoState(1))
  80. {
  81. htmltext = event;
  82. }
  83. break;
  84. }
  85. case "32760-05.html":
  86. {
  87. if (st.isMemoState(1))
  88. {
  89. final L2Npc sirra = addSpawn(SIRRA, -23905, -8790, -5384, 56238, false, 0, false, npc.getInstanceId());
  90. sirra.broadcastPacket(new NpcSay(sirra.getObjectId(), Say2.NPC_ALL, sirra.getId(), NpcStringId.YOU_ADVANCED_BRAVELY_BUT_GOT_SUCH_A_TINY_RESULT_HOHOHO));
  91. st.set("ex", 1);
  92. st.setCond(3, true);
  93. htmltext = event;
  94. }
  95. break;
  96. }
  97. case "32760-07.html":
  98. {
  99. if (st.isMemoState(1) && (st.getInt("ex") == 2))
  100. {
  101. st.unset("ex");
  102. st.setMemoState(2);
  103. final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  104. world.removeAllowed(player.getObjectId());
  105. player.setInstanceId(0);
  106. htmltext = event;
  107. }
  108. break;
  109. }
  110. case "32760-08.html":
  111. {
  112. if (st.isMemoState(2))
  113. {
  114. st.setCond(5, true);
  115. player.teleToLocation(EXIT_LOC, 0);
  116. htmltext = event; // TODO: missing "jinia_npc_q10286_10.htm"
  117. }
  118. break;
  119. }
  120. case "32762-02.html":
  121. case "32762-03.html":
  122. {
  123. if (st.isMemoState(1) && (st.getInt("ex") == 1))
  124. {
  125. htmltext = event;
  126. }
  127. break;
  128. }
  129. case "32762-04.html":
  130. {
  131. if (st.isMemoState(1) && (st.getInt("ex") == 1))
  132. {
  133. if (!st.hasQuestItems(BLACK_FROZEN_CORE))
  134. {
  135. st.giveItems(BLACK_FROZEN_CORE, 5);
  136. }
  137. st.set("ex", 2);
  138. st.setCond(4, true);
  139. htmltext = event;
  140. }
  141. break;
  142. }
  143. case "32781-02.html":
  144. case "32781-03.html":
  145. {
  146. if (st.isMemoState(2))
  147. {
  148. htmltext = event;
  149. }
  150. break;
  151. }
  152. }
  153. return htmltext;
  154. }
  155. @Override
  156. public String onTalk(L2Npc npc, L2PcInstance player)
  157. {
  158. QuestState st = getQuestState(player, true);
  159. String htmltext = getNoQuestMsg(player);
  160. switch (st.getState())
  161. {
  162. case State.COMPLETED:
  163. {
  164. if (npc.getId() == RAFFORTY)
  165. {
  166. htmltext = "32020-05.html";
  167. }
  168. break;
  169. }
  170. case State.CREATED:
  171. {
  172. if (npc.getId() == RAFFORTY)
  173. {
  174. st = player.getQuestState(Q10285_MeetingSirra.class.getSimpleName());
  175. htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "32020-01.htm" : "32020-04.htm";
  176. }
  177. break;
  178. }
  179. case State.STARTED:
  180. {
  181. switch (npc.getId())
  182. {
  183. case RAFFORTY:
  184. {
  185. if (st.isMemoState(1))
  186. {
  187. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-06.html" : "32020-08.html";
  188. }
  189. else if (st.isMemoState(2))
  190. {
  191. htmltext = "32020-07.html";
  192. }
  193. break;
  194. }
  195. case JINIA:
  196. {
  197. if (st.isMemoState(1))
  198. {
  199. final int state = st.getInt("ex");
  200. switch (state)
  201. {
  202. case 0:
  203. {
  204. htmltext = "32760-01.html";
  205. break;
  206. }
  207. case 1:
  208. {
  209. htmltext = "32760-05.html";
  210. break;
  211. }
  212. case 2:
  213. {
  214. htmltext = "32760-06.html";
  215. break;
  216. }
  217. }
  218. }
  219. break;
  220. }
  221. case SIRRA:
  222. {
  223. if (st.isMemoState(1))
  224. {
  225. final int state = st.getInt("ex");
  226. if (state == 1)
  227. {
  228. htmltext = "32762-01.html";
  229. }
  230. else if (state == 2)
  231. {
  232. htmltext = "32762-05.html";
  233. }
  234. }
  235. break;
  236. }
  237. case JINIA2:
  238. {
  239. if (st.isMemoState(10))
  240. {
  241. st.addExpAndSp(2152200, 181070);
  242. st.exitQuest(false, true);
  243. htmltext = "32781-01.html";
  244. }
  245. break;
  246. }
  247. }
  248. break;
  249. }
  250. }
  251. return htmltext;
  252. }
  253. }