Q10285_MeetingSirra.java 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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.Q10285_MeetingSirra;
  20. import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
  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. * Meeting Sirra (10285)
  34. * @author Adry_85
  35. */
  36. public final class Q10285_MeetingSirra extends Quest
  37. {
  38. // NPCs
  39. private static final int RAFFORTY = 32020;
  40. private static final int FREYAS_STEWARD = 32029;
  41. private static final int JINIA = 32760;
  42. private static final int KEGOR = 32761;
  43. private static final int SIRRA = 32762;
  44. private static final int JINIA2 = 32781;
  45. // Misc
  46. private static final int MIN_LEVEL = 82;
  47. // Locations
  48. private static final Location EXIT_LOC = new Location(113793, -109342, -845, 0);
  49. private static final Location FREYA_LOC = new Location(103045, -124361, -2768, 0);
  50. public Q10285_MeetingSirra()
  51. {
  52. super(10285, Q10285_MeetingSirra.class.getSimpleName(), "Meeting Sirra");
  53. addStartNpc(RAFFORTY);
  54. addTalkId(RAFFORTY, JINIA, KEGOR, SIRRA, JINIA2, FREYAS_STEWARD);
  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. htmltext = event;
  70. break;
  71. }
  72. case "32020-03.htm":
  73. {
  74. st.startQuest();
  75. st.setMemoState(1);
  76. htmltext = event;
  77. break;
  78. }
  79. case "32760-02.html":
  80. {
  81. if (st.isMemoState(1) && (st.getInt("ex") == 0))
  82. {
  83. st.set("ex", 1);
  84. st.setCond(3, true);
  85. htmltext = event;
  86. }
  87. break;
  88. }
  89. case "32760-05.html":
  90. {
  91. if (st.isMemoState(1) && (st.getInt("ex") == 2))
  92. {
  93. htmltext = event;
  94. }
  95. break;
  96. }
  97. case "32760-06.html":
  98. {
  99. if (st.isMemoState(1) && (st.getInt("ex") == 2))
  100. {
  101. final L2Npc sirra = addSpawn(SIRRA, -23905, -8790, -5384, 56238, false, 0, false, npc.getInstanceId());
  102. sirra.broadcastPacket(new NpcSay(sirra.getObjectId(), Say2.NPC_ALL, sirra.getId(), NpcStringId.THERES_NOTHING_YOU_CANT_SAY_I_CANT_LISTEN_TO_YOU_ANYMORE));
  103. st.set("ex", 3);
  104. st.setCond(5, true);
  105. htmltext = event;
  106. }
  107. break;
  108. }
  109. case "32760-09.html":
  110. case "32760-10.html":
  111. case "32760-11.html":
  112. {
  113. if (st.isMemoState(1) && (st.getInt("ex") == 4))
  114. {
  115. htmltext = event;
  116. }
  117. break;
  118. }
  119. case "32760-12.html":
  120. {
  121. if (st.isMemoState(1) && (st.getInt("ex") == 4))
  122. {
  123. st.set("ex", 5);
  124. st.setCond(7, true);
  125. htmltext = event;
  126. }
  127. break;
  128. }
  129. case "32760-13.html":
  130. {
  131. if (st.isMemoState(1) && (st.getInt("ex") == 5))
  132. {
  133. st.unset("ex");
  134. st.setMemoState(2);
  135. final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  136. world.removeAllowed(player.getObjectId());
  137. player.setInstanceId(0);
  138. htmltext = event;
  139. }
  140. break;
  141. }
  142. case "32760-14.html":
  143. {
  144. if (st.isMemoState(2))
  145. {
  146. player.teleToLocation(EXIT_LOC, 0);
  147. htmltext = event;
  148. }
  149. break;
  150. }
  151. case "32761-02.html":
  152. {
  153. if (st.isMemoState(1) && (st.getInt("ex") == 1))
  154. {
  155. st.set("ex", 2);
  156. st.setCond(4, true);
  157. htmltext = event;
  158. }
  159. break;
  160. }
  161. case "32762-02.html":
  162. case "32762-03.html":
  163. case "32762-04.html":
  164. case "32762-05.html":
  165. case "32762-06.html":
  166. case "32762-07.html":
  167. {
  168. if (st.isMemoState(1) && (st.getInt("ex") == 3))
  169. {
  170. htmltext = event;
  171. }
  172. break;
  173. }
  174. case "32762-08.html":
  175. {
  176. if (st.isMemoState(1) && (st.getInt("ex") == 3))
  177. {
  178. st.set("ex", 4);
  179. st.setCond(6, true);
  180. htmltext = event;
  181. npc.deleteMe();
  182. }
  183. break;
  184. }
  185. case "32781-02.html":
  186. case "32781-03.html":
  187. {
  188. if (st.isMemoState(2))
  189. {
  190. htmltext = event;
  191. }
  192. break;
  193. }
  194. case "TELEPORT":
  195. {
  196. if (player.getLevel() >= MIN_LEVEL)
  197. {
  198. player.teleToLocation(FREYA_LOC, 0);
  199. }
  200. break;
  201. }
  202. }
  203. return htmltext;
  204. }
  205. @Override
  206. public String onTalk(L2Npc npc, L2PcInstance player)
  207. {
  208. QuestState st = getQuestState(player, true);
  209. String htmltext = getNoQuestMsg(player);
  210. switch (st.getState())
  211. {
  212. case State.COMPLETED:
  213. {
  214. if (npc.getId() == RAFFORTY)
  215. {
  216. htmltext = "32020-05.htm";
  217. }
  218. break;
  219. }
  220. case State.CREATED:
  221. {
  222. if (npc.getId() == RAFFORTY)
  223. {
  224. st = player.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName());
  225. htmltext = ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted())) ? "32020-01.htm" : "32020-04.htm";
  226. }
  227. break;
  228. }
  229. case State.STARTED:
  230. {
  231. switch (npc.getId())
  232. {
  233. case RAFFORTY:
  234. {
  235. switch (st.getMemoState())
  236. {
  237. case 1:
  238. {
  239. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32020-06.html" : "32020-09.html";
  240. break;
  241. }
  242. case 2:
  243. {
  244. htmltext = "32020-07.html";
  245. break;
  246. }
  247. case 3:
  248. {
  249. st.giveAdena(283425, true);
  250. st.addExpAndSp(939075, 83855);
  251. st.exitQuest(false, true);
  252. htmltext = "32020-08.html";
  253. break;
  254. }
  255. }
  256. break;
  257. }
  258. case JINIA:
  259. {
  260. if (st.isMemoState(1))
  261. {
  262. final int state = st.getInt("ex");
  263. switch (state)
  264. {
  265. case 0:
  266. {
  267. htmltext = "32760-01.html";
  268. break;
  269. }
  270. case 1:
  271. {
  272. htmltext = "32760-03.html";
  273. break;
  274. }
  275. case 2:
  276. {
  277. htmltext = "32760-04.html";
  278. break;
  279. }
  280. case 3:
  281. {
  282. htmltext = "32760-07.html";
  283. break;
  284. }
  285. case 4:
  286. {
  287. htmltext = "32760-08.html";
  288. break;
  289. }
  290. case 5:
  291. {
  292. htmltext = "32760-15.html";
  293. break;
  294. }
  295. }
  296. }
  297. break;
  298. }
  299. case KEGOR:
  300. {
  301. if (st.isMemoState(1))
  302. {
  303. final int state = st.getInt("ex");
  304. switch (state)
  305. {
  306. case 1:
  307. {
  308. htmltext = "32761-01.html";
  309. break;
  310. }
  311. case 2:
  312. {
  313. htmltext = "32761-03.html";
  314. break;
  315. }
  316. case 3:
  317. {
  318. htmltext = "32761-04.html";
  319. break;
  320. }
  321. }
  322. }
  323. break;
  324. }
  325. case SIRRA:
  326. {
  327. if (st.isMemoState(1))
  328. {
  329. final int state = st.getInt("ex");
  330. if (state == 3)
  331. {
  332. htmltext = "32762-01.html";
  333. }
  334. else if (state == 4)
  335. {
  336. htmltext = "32762-09.html";
  337. }
  338. }
  339. break;
  340. }
  341. case JINIA2:
  342. {
  343. if (st.isMemoState(2))
  344. {
  345. htmltext = "32781-01.html";
  346. }
  347. else if (st.isMemoState(3))
  348. {
  349. htmltext = "32781-04.html";
  350. }
  351. break;
  352. }
  353. case FREYAS_STEWARD:
  354. {
  355. if (st.isMemoState(2))
  356. {
  357. htmltext = "32029-01.html";
  358. st.setCond(8, true);
  359. }
  360. break;
  361. }
  362. }
  363. break;
  364. }
  365. }
  366. return htmltext;
  367. }
  368. }