Q00154_SacrificeToTheSea.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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.Q00154_SacrificeToTheSea;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.quest.Quest;
  23. import com.l2jserver.gameserver.model.quest.QuestState;
  24. /**
  25. * Sacrifice to the Sea (154)
  26. * @author Pandragon
  27. */
  28. public final class Q00154_SacrificeToTheSea extends Quest
  29. {
  30. // NPCs
  31. private static final int ROCKSWELL = 30312;
  32. private static final int CRISTEL = 30051;
  33. private static final int ROLLFNAN = 30055;
  34. // Items
  35. private static final int FOX_FUR = 1032;
  36. private static final int FOX_FUR_YAM = 1033;
  37. private static final int MAIDEN_DOLL = 1034;
  38. // Monsters
  39. private static final int ELDER_KELTIR = 20544;
  40. private static final int YOUNG_KELTIR = 20545;
  41. private static final int KELTIR = 20481;
  42. // Reward
  43. private static final int MAGE_EARING = 113;
  44. // Misc
  45. private static final int MIN_LVL = 2;
  46. public Q00154_SacrificeToTheSea()
  47. {
  48. super(154, Q00154_SacrificeToTheSea.class.getSimpleName(), "Sacrifice to the Sea");
  49. addStartNpc(ROCKSWELL);
  50. addTalkId(ROCKSWELL, CRISTEL, ROLLFNAN);
  51. addKillId(ELDER_KELTIR, YOUNG_KELTIR, KELTIR);
  52. registerQuestItems(FOX_FUR, FOX_FUR_YAM, MAIDEN_DOLL);
  53. }
  54. @Override
  55. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  56. {
  57. final QuestState qs = getQuestState(player, false);
  58. if ((qs != null) && event.equals("30312-03.htm"))
  59. {
  60. qs.startQuest();
  61. return event;
  62. }
  63. return null;
  64. }
  65. @Override
  66. public String onTalk(L2Npc npc, L2PcInstance talker)
  67. {
  68. final QuestState qs = getQuestState(talker, true);
  69. String htmltext = getNoQuestMsg(talker);
  70. switch (npc.getId())
  71. {
  72. case ROCKSWELL:
  73. {
  74. if (qs.isCreated())
  75. {
  76. htmltext = ((talker.getLevel() >= MIN_LVL) ? "30312-01.htm" : "30312-02.htm");
  77. }
  78. else if (qs.isStarted())
  79. {
  80. switch (qs.getCond())
  81. {
  82. case 1:
  83. {
  84. htmltext = "30312-04.html";
  85. break;
  86. }
  87. case 2:
  88. {
  89. htmltext = "30312-07.html";
  90. break;
  91. }
  92. case 3:
  93. {
  94. htmltext = "30312-05.html";
  95. break;
  96. }
  97. case 4:
  98. {
  99. takeItems(talker, MAIDEN_DOLL, -1);
  100. rewardItems(talker, MAGE_EARING, 1);
  101. addExpAndSp(talker, 0, 1000);
  102. qs.exitQuest(false, true);
  103. htmltext = "30312-06.html";
  104. break;
  105. }
  106. }
  107. }
  108. else
  109. {
  110. htmltext = getAlreadyCompletedMsg(talker);
  111. }
  112. break;
  113. }
  114. case CRISTEL:
  115. {
  116. switch (qs.getCond())
  117. {
  118. case 1:
  119. {
  120. htmltext = "30051-02.html";
  121. break;
  122. }
  123. case 2:
  124. {
  125. takeItems(talker, FOX_FUR, -1);
  126. giveItems(talker, FOX_FUR_YAM, 1);
  127. qs.setCond(3, true);
  128. htmltext = "30051-01.html";
  129. break;
  130. }
  131. case 3:
  132. {
  133. htmltext = "30051-03.html";
  134. break;
  135. }
  136. case 4:
  137. {
  138. htmltext = "30051-04.html";
  139. break;
  140. }
  141. }
  142. break;
  143. }
  144. case ROLLFNAN:
  145. {
  146. switch (qs.getCond())
  147. {
  148. case 1:
  149. case 2:
  150. {
  151. htmltext = "30055-03.html";
  152. break;
  153. }
  154. case 3:
  155. {
  156. takeItems(talker, FOX_FUR_YAM, -1);
  157. giveItems(talker, MAIDEN_DOLL, 1);
  158. qs.setCond(4, true);
  159. htmltext = "30055-01.html";
  160. break;
  161. }
  162. case 4:
  163. {
  164. htmltext = "30055-02.html";
  165. break;
  166. }
  167. }
  168. break;
  169. }
  170. }
  171. return htmltext;
  172. }
  173. @Override
  174. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  175. {
  176. final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
  177. if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FOX_FUR, 1, 10, 0.3, true))
  178. {
  179. qs.setCond(2);
  180. }
  181. return super.onKill(npc, killer, isSummon);
  182. }
  183. }