Q00002_WhatWomenWant.java 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.Q00002_WhatWomenWant;
  20. import com.l2jserver.gameserver.enums.Race;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  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. import com.l2jserver.gameserver.network.NpcStringId;
  27. /**
  28. * What Women Want (2)
  29. * @author malyelfik
  30. */
  31. public class Q00002_WhatWomenWant extends Quest
  32. {
  33. // NPCs
  34. private static final int ARUJIEN = 30223;
  35. private static final int MIRABEL = 30146;
  36. private static final int HERBIEL = 30150;
  37. private static final int GREENIS = 30157;
  38. // Items
  39. private static final int ARUJIENS_LETTER1 = 1092;
  40. private static final int ARUJIENS_LETTER2 = 1093;
  41. private static final int ARUJIENS_LETTER3 = 1094;
  42. private static final int POETRY_BOOK = 689;
  43. private static final int GREENIS_LETTER = 693;
  44. private static final int EARRING = 113;
  45. // Misc
  46. private static final int MIN_LEVEL = 2;
  47. public Q00002_WhatWomenWant()
  48. {
  49. super(2, Q00002_WhatWomenWant.class.getSimpleName(), "What Women Want");
  50. addStartNpc(ARUJIEN);
  51. addTalkId(ARUJIEN, MIRABEL, HERBIEL, GREENIS);
  52. registerQuestItems(ARUJIENS_LETTER1, ARUJIENS_LETTER2, ARUJIENS_LETTER3, POETRY_BOOK, GREENIS_LETTER);
  53. }
  54. @Override
  55. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  56. {
  57. final QuestState st = getQuestState(player, false);
  58. if (st == null)
  59. {
  60. return null;
  61. }
  62. String htmltext = event;
  63. switch (event)
  64. {
  65. case "30223-04.htm":
  66. st.startQuest();
  67. giveItems(player, ARUJIENS_LETTER1, 1);
  68. break;
  69. case "30223-08.html":
  70. takeItems(player, ARUJIENS_LETTER3, -1);
  71. giveItems(player, POETRY_BOOK, 1);
  72. st.setCond(4, true);
  73. break;
  74. case "30223-09.html":
  75. giveAdena(player, 450, true);
  76. st.exitQuest(false, true);
  77. // Newbie Guide
  78. showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000);
  79. addExpAndSp(player, 4254, 335);
  80. giveAdena(player, 1850, true);
  81. break;
  82. case "30223-03.html":
  83. break;
  84. default:
  85. htmltext = null;
  86. break;
  87. }
  88. return htmltext;
  89. }
  90. @Override
  91. public String onTalk(L2Npc npc, L2PcInstance player)
  92. {
  93. String htmltext = getNoQuestMsg(player);
  94. final QuestState st = getQuestState(player, true);
  95. switch (npc.getId())
  96. {
  97. case ARUJIEN:
  98. switch (st.getState())
  99. {
  100. case State.CREATED:
  101. htmltext = ((player.getRace() != Race.ELF) && (player.getRace() != Race.HUMAN)) ? "30223-00.htm" : (player.getLevel() >= MIN_LEVEL) ? "30223-02.htm" : "30223-01.html";
  102. break;
  103. case State.STARTED:
  104. switch (st.getCond())
  105. {
  106. case 1:
  107. htmltext = "30223-05.html";
  108. break;
  109. case 2:
  110. htmltext = "30223-06.html";
  111. break;
  112. case 3:
  113. htmltext = "30223-07.html";
  114. break;
  115. case 4:
  116. htmltext = "30223-10.html";
  117. break;
  118. case 5:
  119. giveItems(player, EARRING, 1);
  120. st.exitQuest(false, true);
  121. htmltext = "30223-11.html";
  122. // Newbie Guide
  123. showOnScreenMsg(player, NpcStringId.DELIVERY_DUTY_COMPLETE_N_GO_FIND_THE_NEWBIE_GUIDE, 2, 5000);
  124. addExpAndSp(player, 4254, 335);
  125. giveAdena(player, 1850, true);
  126. break;
  127. }
  128. break;
  129. case State.COMPLETED:
  130. htmltext = getAlreadyCompletedMsg(player);
  131. break;
  132. }
  133. break;
  134. case MIRABEL:
  135. if (st.isStarted())
  136. {
  137. if (st.isCond(1))
  138. {
  139. st.setCond(2, true);
  140. takeItems(player, ARUJIENS_LETTER1, -1);
  141. giveItems(player, ARUJIENS_LETTER2, 1);
  142. htmltext = "30146-01.html";
  143. }
  144. else
  145. {
  146. htmltext = "30146-02.html";
  147. }
  148. }
  149. break;
  150. case HERBIEL:
  151. if (st.isStarted() && (st.getCond() > 1))
  152. {
  153. if (st.isCond(2))
  154. {
  155. st.setCond(3, true);
  156. takeItems(player, ARUJIENS_LETTER2, -1);
  157. giveItems(player, ARUJIENS_LETTER3, 1);
  158. htmltext = "30150-01.html";
  159. }
  160. else
  161. {
  162. htmltext = "30150-02.html";
  163. }
  164. }
  165. break;
  166. case GREENIS:
  167. if (st.isStarted())
  168. {
  169. if (st.isCond(4))
  170. {
  171. st.setCond(5, true);
  172. takeItems(player, POETRY_BOOK, -1);
  173. giveItems(player, GREENIS_LETTER, 1);
  174. htmltext = "30157-02.html";
  175. }
  176. else if (st.isCond(5))
  177. {
  178. htmltext = "30157-03.html";
  179. }
  180. else
  181. {
  182. htmltext = "30157-01.html";
  183. }
  184. }
  185. break;
  186. }
  187. return htmltext;
  188. }
  189. }