Q00174_SupplyCheck.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.Q00174_SupplyCheck;
  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. import com.l2jserver.gameserver.model.quest.State;
  25. import com.l2jserver.gameserver.network.NpcStringId;
  26. /**
  27. * Supply Check (174)
  28. * @author malyelfik
  29. */
  30. public class Q00174_SupplyCheck extends Quest
  31. {
  32. // NPCs
  33. private static final int NIKA = 32167;
  34. private static final int BENIS = 32170;
  35. private static final int MARCELA = 32173;
  36. // Items
  37. private static final int WAREHOUSE_MANIFEST = 9792;
  38. private static final int GROCERY_STORE_MANIFEST = 9793;
  39. private static final int[] REWARD =
  40. {
  41. 23, // Wooden Breastplate
  42. 43, // Wooden Helmet
  43. 49, // Gloves
  44. 2386, // Wooden Gaiters
  45. 37, // Leather Shoes
  46. };
  47. // Misc
  48. private static final int MIN_LEVEL = 2;
  49. public Q00174_SupplyCheck()
  50. {
  51. super(174, Q00174_SupplyCheck.class.getSimpleName(), "Supply Check");
  52. addStartNpc(MARCELA);
  53. addTalkId(MARCELA, BENIS, NIKA);
  54. registerQuestItems(WAREHOUSE_MANIFEST, GROCERY_STORE_MANIFEST);
  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. if (event.equalsIgnoreCase("32173-03.htm"))
  65. {
  66. st.startQuest();
  67. return event;
  68. }
  69. return null;
  70. }
  71. @Override
  72. public String onTalk(L2Npc npc, L2PcInstance player)
  73. {
  74. String htmltext = getNoQuestMsg(player);
  75. final QuestState st = getQuestState(player, true);
  76. if (st == null)
  77. {
  78. return htmltext;
  79. }
  80. switch (npc.getId())
  81. {
  82. case MARCELA:
  83. switch (st.getState())
  84. {
  85. case State.CREATED:
  86. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32173-01.htm" : "32173-02.htm";
  87. break;
  88. case State.STARTED:
  89. switch (st.getCond())
  90. {
  91. case 1:
  92. htmltext = "32173-04.html";
  93. break;
  94. case 2:
  95. st.setCond(3, true);
  96. st.takeItems(WAREHOUSE_MANIFEST, -1);
  97. htmltext = "32173-05.html";
  98. break;
  99. case 3:
  100. htmltext = "32173-06.html";
  101. break;
  102. case 4:
  103. for (int itemId : REWARD)
  104. {
  105. st.giveItems(itemId, 1);
  106. }
  107. st.giveAdena(2466, true);
  108. st.addExpAndSp(5672, 446);
  109. st.exitQuest(false, true);
  110. // Newbie Guide
  111. showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000);
  112. htmltext = "32173-07.html";
  113. break;
  114. }
  115. break;
  116. case State.COMPLETED:
  117. htmltext = getAlreadyCompletedMsg(player);
  118. break;
  119. }
  120. break;
  121. case BENIS:
  122. if (st.isStarted())
  123. {
  124. switch (st.getCond())
  125. {
  126. case 1:
  127. st.setCond(2, true);
  128. st.giveItems(WAREHOUSE_MANIFEST, 1);
  129. htmltext = "32170-01.html";
  130. break;
  131. case 2:
  132. htmltext = "32170-02.html";
  133. break;
  134. default:
  135. htmltext = "32170-03.html";
  136. break;
  137. }
  138. }
  139. break;
  140. case NIKA:
  141. if (st.isStarted())
  142. {
  143. switch (st.getCond())
  144. {
  145. case 1:
  146. case 2:
  147. htmltext = "32167-01.html";
  148. break;
  149. case 3:
  150. st.setCond(4, true);
  151. st.giveItems(GROCERY_STORE_MANIFEST, 1);
  152. htmltext = "32167-02.html";
  153. break;
  154. case 4:
  155. htmltext = "32167-03.html";
  156. break;
  157. }
  158. }
  159. break;
  160. }
  161. return htmltext;
  162. }
  163. }