Q00033_MakeAPairOfDressShoes.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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.Q00033_MakeAPairOfDressShoes;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.itemcontainer.Inventory;
  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. * Make a Pair of Dress Shoes (33)
  28. * @author malyelfik
  29. */
  30. public class Q00033_MakeAPairOfDressShoes extends Quest
  31. {
  32. // NPCs
  33. private static final int IAN = 30164;
  34. private static final int WOODLEY = 30838;
  35. private static final int LEIKAR = 31520;
  36. // Items
  37. private static final int LEATHER = 1882;
  38. private static final int THREAD = 1868;
  39. private static final int DRESS_SHOES_BOX = 7113;
  40. // Misc
  41. private static final int MIN_LEVEL = 60;
  42. private static final int LEATHER_COUNT = 200;
  43. private static final int THREAD_COUNT = 600;
  44. private static final int ADENA_COUNT = 500000;
  45. private static final int ADENA_COUNT2 = 200000;
  46. private static final int ADENA_COUNT3 = 300000;
  47. public Q00033_MakeAPairOfDressShoes()
  48. {
  49. super(33, Q00033_MakeAPairOfDressShoes.class.getSimpleName(), "Make a Pair of Dress Shoes");
  50. addStartNpc(WOODLEY);
  51. addTalkId(WOODLEY, IAN, LEIKAR);
  52. }
  53. @Override
  54. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  55. {
  56. final QuestState st = getQuestState(player, false);
  57. if (st == null)
  58. {
  59. return null;
  60. }
  61. String htmltext = event;
  62. switch (event)
  63. {
  64. case "30838-03.htm":
  65. st.startQuest();
  66. break;
  67. case "30838-06.html":
  68. st.setCond(3, true);
  69. break;
  70. case "30838-09.html":
  71. if ((st.getQuestItemsCount(LEATHER) >= LEATHER_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && (player.getAdena() >= ADENA_COUNT2))
  72. {
  73. st.takeItems(LEATHER, LEATHER_COUNT);
  74. st.takeItems(THREAD, LEATHER_COUNT);
  75. st.takeItems(Inventory.ADENA_ID, ADENA_COUNT2);
  76. st.setCond(4, true);
  77. }
  78. else
  79. {
  80. htmltext = "30838-10.html";
  81. }
  82. break;
  83. case "30838-13.html":
  84. st.giveItems(DRESS_SHOES_BOX, 1);
  85. st.exitQuest(false, true);
  86. break;
  87. case "31520-02.html":
  88. st.setCond(2, true);
  89. break;
  90. case "30164-02.html":
  91. if (player.getAdena() < ADENA_COUNT3)
  92. {
  93. return "30164-03.html";
  94. }
  95. st.takeItems(Inventory.ADENA_ID, ADENA_COUNT3);
  96. st.setCond(5, true);
  97. break;
  98. default:
  99. htmltext = null;
  100. break;
  101. }
  102. return htmltext;
  103. }
  104. @Override
  105. public String onTalk(L2Npc npc, L2PcInstance player)
  106. {
  107. String htmltext = getNoQuestMsg(player);
  108. final QuestState st = getQuestState(player, true);
  109. if (st == null)
  110. {
  111. return htmltext;
  112. }
  113. switch (npc.getId())
  114. {
  115. case WOODLEY:
  116. switch (st.getState())
  117. {
  118. case State.CREATED:
  119. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30838-01.htm" : "30838-02.html";
  120. break;
  121. case State.STARTED:
  122. switch (st.getCond())
  123. {
  124. case 1:
  125. htmltext = "30838-04.html";
  126. break;
  127. case 2:
  128. htmltext = "30838-05.html";
  129. break;
  130. case 3:
  131. htmltext = ((st.getQuestItemsCount(LEATHER) >= LEATHER_COUNT) && (st.getQuestItemsCount(THREAD) >= THREAD_COUNT) && (player.getAdena() >= ADENA_COUNT)) ? "30838-07.html" : "30838-08.html";
  132. break;
  133. case 4:
  134. htmltext = "30838-11.html";
  135. break;
  136. case 5:
  137. htmltext = "30838-12.html";
  138. break;
  139. }
  140. break;
  141. case State.COMPLETED:
  142. htmltext = getAlreadyCompletedMsg(player);
  143. break;
  144. }
  145. break;
  146. case LEIKAR:
  147. if (st.isStarted())
  148. {
  149. if (st.isCond(1))
  150. {
  151. htmltext = "31520-01.html";
  152. }
  153. else if (st.isCond(2))
  154. {
  155. htmltext = "31520-03.html";
  156. }
  157. }
  158. break;
  159. case IAN:
  160. if (st.isStarted())
  161. {
  162. if (st.isCond(4))
  163. {
  164. htmltext = "30164-01.html";
  165. }
  166. else if (st.isCond(5))
  167. {
  168. htmltext = "30164-04.html";
  169. }
  170. }
  171. break;
  172. }
  173. return htmltext;
  174. }
  175. }