Q00130_PathToHellbound.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.Q00130_PathToHellbound;
  20. import hellbound.HellboundEngine;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * Path To Hellbound (130)
  28. * @author Zoey76
  29. */
  30. public class Q00130_PathToHellbound extends Quest
  31. {
  32. // NPCs
  33. private static final int CASIAN = 30612;
  34. private static final int GALATE = 32292;
  35. // Item
  36. private static final int CASIANS_BLUE_CRYSTAL = 12823;
  37. // Misc
  38. private static final int MIN_LEVEL = 78;
  39. public Q00130_PathToHellbound()
  40. {
  41. super(130, Q00130_PathToHellbound.class.getSimpleName(), "Path To Hellbound");
  42. addStartNpc(CASIAN);
  43. addTalkId(CASIAN, GALATE);
  44. registerQuestItems(CASIANS_BLUE_CRYSTAL);
  45. }
  46. @Override
  47. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  48. {
  49. final QuestState st = getQuestState(player, false);
  50. if (st == null)
  51. {
  52. return null;
  53. }
  54. String htmltext = null;
  55. switch (event)
  56. {
  57. case "30612-04.htm":
  58. {
  59. htmltext = event;
  60. break;
  61. }
  62. case "32292-02.html":
  63. {
  64. if (st.isCond(1))
  65. {
  66. htmltext = event;
  67. }
  68. break;
  69. }
  70. case "32292-06.html":
  71. {
  72. if (st.isCond(3))
  73. {
  74. htmltext = event;
  75. }
  76. break;
  77. }
  78. case "30612-05.html":
  79. {
  80. st.startQuest();
  81. htmltext = event;
  82. break;
  83. }
  84. case "30612-08.html":
  85. {
  86. if (st.isCond(2))
  87. {
  88. st.giveItems(CASIANS_BLUE_CRYSTAL, 1);
  89. st.setCond(3, true);
  90. htmltext = event;
  91. }
  92. break;
  93. }
  94. case "32292-03.html":
  95. {
  96. if (st.isCond(1))
  97. {
  98. st.setCond(2, true);
  99. htmltext = event;
  100. }
  101. break;
  102. }
  103. case "32292-07.html":
  104. {
  105. if (st.isCond(3) && st.hasQuestItems(CASIANS_BLUE_CRYSTAL))
  106. {
  107. st.exitQuest(false, true);
  108. htmltext = event;
  109. }
  110. break;
  111. }
  112. }
  113. return htmltext;
  114. }
  115. @Override
  116. public String onTalk(L2Npc npc, L2PcInstance player)
  117. {
  118. final QuestState st = getQuestState(player, true);
  119. String htmltext = getNoQuestMsg(player);
  120. if (st == null)
  121. {
  122. return htmltext;
  123. }
  124. switch (st.getState())
  125. {
  126. case State.COMPLETED:
  127. {
  128. htmltext = getAlreadyCompletedMsg(player);
  129. break;
  130. }
  131. case State.CREATED:
  132. {
  133. if (npc.getId() == CASIAN)
  134. {
  135. if (!HellboundEngine.getInstance().isLocked())
  136. {
  137. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30612-01.htm" : "30612-02.html";
  138. }
  139. else
  140. {
  141. htmltext = "30612-03.html";
  142. }
  143. }
  144. break;
  145. }
  146. case State.STARTED:
  147. {
  148. if (npc.getId() == CASIAN)
  149. {
  150. switch (st.getCond())
  151. {
  152. case 1:
  153. {
  154. htmltext = "30612-06.html";
  155. break;
  156. }
  157. case 2:
  158. {
  159. htmltext = "30612-07.html";
  160. break;
  161. }
  162. case 3:
  163. {
  164. htmltext = "30612-09.html";
  165. break;
  166. }
  167. }
  168. }
  169. else if (npc.getId() == GALATE)
  170. {
  171. switch (st.getCond())
  172. {
  173. case 1:
  174. {
  175. htmltext = "32292-01.html";
  176. break;
  177. }
  178. case 2:
  179. {
  180. htmltext = "32292-04.html";
  181. break;
  182. }
  183. case 3:
  184. {
  185. htmltext = "32292-05.html";
  186. break;
  187. }
  188. }
  189. }
  190. break;
  191. }
  192. }
  193. return htmltext;
  194. }
  195. }