Q00116_BeyondTheHillsOfWinter.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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.Q00116_BeyondTheHillsOfWinter;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.holders.ItemHolder;
  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. * Beyond the Hills of Winter (116)
  28. * @author Adry_85
  29. */
  30. public final class Q00116_BeyondTheHillsOfWinter extends Quest
  31. {
  32. // NPCs
  33. private static final int FILAUR = 30535;
  34. private static final int OBI = 32052;
  35. // Items
  36. private static final ItemHolder THIEF_KEY = new ItemHolder(1661, 10);
  37. private static final ItemHolder BANDAGE = new ItemHolder(1833, 20);
  38. private static final ItemHolder ENERGY_STONE = new ItemHolder(5589, 5);
  39. private static final int SUPPLYING_GOODS = 8098;
  40. // Reward
  41. private static final int SOULSHOT_D = 1463;
  42. // Misc
  43. private static final int MIN_LEVEL = 30;
  44. public Q00116_BeyondTheHillsOfWinter()
  45. {
  46. super(116, Q00116_BeyondTheHillsOfWinter.class.getSimpleName(), "Beyond the Hills of Winter");
  47. addStartNpc(FILAUR);
  48. addTalkId(FILAUR, OBI);
  49. registerQuestItems(SUPPLYING_GOODS);
  50. }
  51. @Override
  52. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  53. {
  54. final QuestState st = getQuestState(player, false);
  55. if (st == null)
  56. {
  57. return null;
  58. }
  59. String htmltext = null;
  60. switch (event)
  61. {
  62. case "30535-02.htm":
  63. {
  64. st.startQuest();
  65. st.setMemoState(1);
  66. htmltext = event;
  67. break;
  68. }
  69. case "30535-05.html":
  70. {
  71. if (st.isMemoState(1))
  72. {
  73. st.setMemoState(2);
  74. st.setCond(2, true);
  75. st.giveItems(SUPPLYING_GOODS, 1);
  76. htmltext = event;
  77. }
  78. break;
  79. }
  80. case "32052-02.html":
  81. {
  82. if (st.isMemoState(2))
  83. {
  84. htmltext = event;
  85. }
  86. break;
  87. }
  88. case "MATERIAL":
  89. {
  90. if (st.isMemoState(2))
  91. {
  92. st.rewardItems(SOULSHOT_D, 1740);
  93. st.addExpAndSp(82792, 4981);
  94. st.exitQuest(false, true);
  95. htmltext = "32052-03.html";
  96. }
  97. break;
  98. }
  99. case "ADENA":
  100. {
  101. if (st.isMemoState(2))
  102. {
  103. st.giveAdena(17387, true);
  104. st.addExpAndSp(82792, 4981);
  105. st.exitQuest(false, true);
  106. htmltext = "32052-03.html";
  107. }
  108. break;
  109. }
  110. }
  111. return htmltext;
  112. }
  113. @Override
  114. public String onTalk(L2Npc npc, L2PcInstance player)
  115. {
  116. final QuestState st = getQuestState(player, true);
  117. String htmltext = getNoQuestMsg(player);
  118. switch (st.getState())
  119. {
  120. case State.COMPLETED:
  121. {
  122. if (npc.getId() == FILAUR)
  123. {
  124. htmltext = getAlreadyCompletedMsg(player);
  125. }
  126. break;
  127. }
  128. case State.CREATED:
  129. {
  130. if (npc.getId() == FILAUR)
  131. {
  132. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30535-01.htm" : "30535-03.htm";
  133. }
  134. break;
  135. }
  136. case State.STARTED:
  137. {
  138. switch (npc.getId())
  139. {
  140. case FILAUR:
  141. {
  142. if (st.isMemoState(1))
  143. {
  144. htmltext = (hasAllItems(player, true, THIEF_KEY, BANDAGE, ENERGY_STONE)) ? "30535-04.html" : "30535-06.html";
  145. }
  146. else if (st.isMemoState(2))
  147. {
  148. htmltext = "30535-07.html";
  149. }
  150. break;
  151. }
  152. case OBI:
  153. {
  154. if (st.isMemoState(2) && st.hasQuestItems(SUPPLYING_GOODS))
  155. {
  156. htmltext = "32052-01.html";
  157. }
  158. break;
  159. }
  160. }
  161. break;
  162. }
  163. }
  164. return htmltext;
  165. }
  166. }