Q00156_MillenniumLove.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.Q00156_MillenniumLove;
  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. /**
  26. * Millennium Love (156)
  27. * @author xban1x
  28. */
  29. public class Q00156_MillenniumLove extends Quest
  30. {
  31. // NPCs
  32. private static final int LILITH = 30368;
  33. private static final int BAENEDES = 30369;
  34. // Items
  35. private static final int LILITHS_LETTER = 1022;
  36. private static final int THEONS_DIARY = 1023;
  37. private static final int GREATER_COMP_SOULSHOUT_PACKAGE_NO_GRADE = 5250;
  38. // Misc
  39. private static final int MIN_LVL = 15;
  40. public Q00156_MillenniumLove()
  41. {
  42. super(156, Q00156_MillenniumLove.class.getSimpleName(), "Millennium Love");
  43. addStartNpc(LILITH);
  44. addTalkId(LILITH, BAENEDES);
  45. registerQuestItems(LILITHS_LETTER, THEONS_DIARY);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. String htmltext = null;
  52. if (st != null)
  53. {
  54. switch (event)
  55. {
  56. case "30368-02.html":
  57. case "30368-03.html":
  58. {
  59. htmltext = event;
  60. break;
  61. }
  62. case "30368-05.htm":
  63. {
  64. if (player.getLevel() >= MIN_LVL)
  65. {
  66. st.startQuest();
  67. st.giveItems(LILITHS_LETTER, 1);
  68. htmltext = event;
  69. }
  70. else
  71. {
  72. htmltext = "30368-04.htm";
  73. }
  74. break;
  75. }
  76. case "30369-02.html":
  77. {
  78. if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER))
  79. {
  80. st.takeItems(LILITHS_LETTER, 1);
  81. st.giveItems(THEONS_DIARY, 1);
  82. st.setCond(2, true);
  83. htmltext = event;
  84. }
  85. break;
  86. }
  87. case "30369-03.html":
  88. {
  89. if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER))
  90. {
  91. st.addExpAndSp(3000, 0);
  92. st.exitQuest(false, true);
  93. htmltext = event;
  94. }
  95. break;
  96. }
  97. }
  98. }
  99. return htmltext;
  100. }
  101. @Override
  102. public String onTalk(L2Npc npc, L2PcInstance player)
  103. {
  104. final QuestState st = getQuestState(player, true);
  105. String htmltext = getNoQuestMsg(player);
  106. if (st != null)
  107. {
  108. switch (npc.getId())
  109. {
  110. case LILITH:
  111. {
  112. switch (st.getState())
  113. {
  114. case State.CREATED:
  115. {
  116. htmltext = "30368-01.htm";
  117. break;
  118. }
  119. case State.STARTED:
  120. {
  121. if (st.isCond(1) && st.hasQuestItems(LILITHS_LETTER))
  122. {
  123. htmltext = "30368-06.html";
  124. }
  125. else if (st.isCond(2) && st.hasQuestItems(THEONS_DIARY))
  126. {
  127. st.giveItems(GREATER_COMP_SOULSHOUT_PACKAGE_NO_GRADE, 1);
  128. st.addExpAndSp(3000, 0);
  129. st.exitQuest(false, true);
  130. htmltext = "30368-07.html";
  131. }
  132. break;
  133. }
  134. case State.COMPLETED:
  135. {
  136. htmltext = getAlreadyCompletedMsg(player);
  137. break;
  138. }
  139. }
  140. break;
  141. }
  142. case BAENEDES:
  143. {
  144. switch (st.getCond())
  145. {
  146. case 1:
  147. {
  148. if (st.hasQuestItems(LILITHS_LETTER))
  149. {
  150. htmltext = "30369-01.html";
  151. }
  152. break;
  153. }
  154. case 2:
  155. {
  156. if (st.hasQuestItems(THEONS_DIARY))
  157. {
  158. htmltext = "30369-04.html";
  159. }
  160. break;
  161. }
  162. }
  163. break;
  164. }
  165. }
  166. }
  167. return htmltext;
  168. }
  169. }