Q00133_ThatsBloodyHot.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.Q00133_ThatsBloodyHot;
  20. import hellbound.HellboundEngine;
  21. import quests.Q00131_BirdInACage.Q00131_BirdInACage;
  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. * That's Bloody Hot! (133)
  29. * @author Zoey76
  30. */
  31. public class Q00133_ThatsBloodyHot extends Quest
  32. {
  33. // NPCs
  34. private static final int KANIS = 32264;
  35. private static final int GALATE = 32292;
  36. // Item
  37. private static final int REFINED_CRYSTAL_SAMPLE = 9785;
  38. // Misc
  39. private static final int MIN_LEVEL = 78;
  40. public Q00133_ThatsBloodyHot()
  41. {
  42. super(133, Q00133_ThatsBloodyHot.class.getSimpleName(), "That's Bloody Hot!");
  43. addStartNpc(KANIS);
  44. addTalkId(KANIS, GALATE);
  45. registerQuestItems(REFINED_CRYSTAL_SAMPLE);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. if (st == null)
  52. {
  53. return null;
  54. }
  55. String htmltext = null;
  56. switch (event)
  57. {
  58. case "32264-04.html":
  59. {
  60. if (player.getLevel() >= MIN_LEVEL)
  61. {
  62. st.startQuest();
  63. htmltext = event;
  64. }
  65. break;
  66. }
  67. case "32264-06.html":
  68. case "32264-07.html":
  69. {
  70. if (st.isCond(1))
  71. {
  72. htmltext = event;
  73. }
  74. break;
  75. }
  76. case "32264-08.html":
  77. {
  78. st.setCond(2);
  79. htmltext = event;
  80. break;
  81. }
  82. case "32264-10.html":
  83. case "32264-11.html":
  84. {
  85. if (st.isCond(2))
  86. {
  87. htmltext = event;
  88. }
  89. break;
  90. }
  91. case "32264-12.html":
  92. {
  93. if (st.isCond(2))
  94. {
  95. st.giveItems(REFINED_CRYSTAL_SAMPLE, 1);
  96. st.setCond(3);
  97. htmltext = event;
  98. }
  99. break;
  100. }
  101. case "32292-03.html":
  102. {
  103. if (st.isCond(3))
  104. {
  105. htmltext = event;
  106. }
  107. break;
  108. }
  109. case "32292-05.html":
  110. {
  111. if (st.isCond(3) && st.hasQuestItems(REFINED_CRYSTAL_SAMPLE))
  112. {
  113. st.takeItems(REFINED_CRYSTAL_SAMPLE, -1);
  114. htmltext = event;
  115. st.setCond(4);
  116. }
  117. break;
  118. }
  119. case "32292-06.html":
  120. {
  121. if (st.isCond(4))
  122. {
  123. if (!HellboundEngine.getInstance().isLocked())
  124. {
  125. st.giveAdena(254247, true);
  126. st.addExpAndSp(331457, 32524);
  127. st.exitQuest(false, true);
  128. htmltext = event;
  129. }
  130. else
  131. {
  132. HellboundEngine.getInstance().setLevel(1);
  133. st.giveAdena(254247, true);
  134. st.addExpAndSp(325881, 32524);
  135. st.exitQuest(false, true);
  136. htmltext = "32292-07.html";
  137. }
  138. }
  139. break;
  140. }
  141. }
  142. return htmltext;
  143. }
  144. @Override
  145. public String onTalk(L2Npc npc, L2PcInstance player)
  146. {
  147. final QuestState st = getQuestState(player, true);
  148. String htmltext = getNoQuestMsg(player);
  149. if (st == null)
  150. {
  151. return htmltext;
  152. }
  153. switch (st.getState())
  154. {
  155. case State.COMPLETED:
  156. {
  157. htmltext = getAlreadyCompletedMsg(player);
  158. break;
  159. }
  160. case State.CREATED:
  161. {
  162. if (npc.getId() == KANIS)
  163. {
  164. final QuestState qs = player.getQuestState(Q00131_BirdInACage.class.getSimpleName());
  165. if ((qs != null) && qs.isCompleted())
  166. {
  167. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32264-01.htm" : "32264-02.html";
  168. }
  169. else
  170. {
  171. htmltext = "32264-03.html";
  172. }
  173. }
  174. break;
  175. }
  176. case State.STARTED:
  177. {
  178. if (npc.getId() == KANIS)
  179. {
  180. if (st.isCond(1))
  181. {
  182. htmltext = "32264-05.html";
  183. }
  184. else if (st.isCond(2))
  185. {
  186. htmltext = "32264-09.html";
  187. }
  188. else if (st.getCond() >= 3)
  189. {
  190. htmltext = "32264-13.html";
  191. }
  192. }
  193. else if (npc.getId() == GALATE)
  194. {
  195. if (st.getCond() < 3)
  196. {
  197. htmltext = "32292-01.html";
  198. }
  199. else if (st.isCond(3))
  200. {
  201. htmltext = "32292-02.html";
  202. }
  203. else if (st.isCond(4))
  204. {
  205. htmltext = "32292-04.html";
  206. }
  207. }
  208. break;
  209. }
  210. }
  211. return htmltext;
  212. }
  213. }