Q10271_TheEnvelopingDarkness.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.Q10271_TheEnvelopingDarkness;
  20. import quests.Q10269_ToTheSeedOfDestruction.Q10269_ToTheSeedOfDestruction;
  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. /**
  27. * The Enveloping Darkness (10271)
  28. * @author Gladicek
  29. */
  30. public class Q10271_TheEnvelopingDarkness extends Quest
  31. {
  32. private static final int ORBYU = 32560;
  33. private static final int EL = 32556;
  34. private static final int MEDIBAL_CORPSE = 32528;
  35. private static final int MEDIBAL_DOCUMENT = 13852;
  36. public Q10271_TheEnvelopingDarkness()
  37. {
  38. super(10271, Q10271_TheEnvelopingDarkness.class.getSimpleName(), "The Enveloping Darkness");
  39. addStartNpc(ORBYU);
  40. addTalkId(ORBYU, EL, MEDIBAL_CORPSE);
  41. registerQuestItems(MEDIBAL_DOCUMENT);
  42. }
  43. @Override
  44. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  45. {
  46. final QuestState st = getQuestState(player, false);
  47. if (st == null)
  48. {
  49. return getNoQuestMsg(player);
  50. }
  51. switch (event)
  52. {
  53. case "32560-05.html":
  54. st.startQuest();
  55. break;
  56. case "32556-06.html":
  57. st.setCond(2, true);
  58. break;
  59. case "32556-09.html":
  60. if (st.hasQuestItems(MEDIBAL_DOCUMENT))
  61. {
  62. st.takeItems(MEDIBAL_DOCUMENT, -1);
  63. st.setCond(4, true);
  64. }
  65. break;
  66. default:
  67. break;
  68. }
  69. return event;
  70. }
  71. @Override
  72. public String onTalk(L2Npc npc, L2PcInstance player)
  73. {
  74. String htmltext = getNoQuestMsg(player);
  75. QuestState st = getQuestState(player, true);
  76. if (st == null)
  77. {
  78. return htmltext;
  79. }
  80. switch (npc.getId())
  81. {
  82. case ORBYU:
  83. switch (st.getState())
  84. {
  85. case State.CREATED:
  86. st = player.getQuestState(Q10269_ToTheSeedOfDestruction.class.getSimpleName());
  87. htmltext = ((player.getLevel() >= 75) && (st != null) && st.isCompleted()) ? "32560-01.htm" : "32560-02.html";
  88. break;
  89. case State.STARTED:
  90. switch (st.getCond())
  91. {
  92. case 1:
  93. htmltext = "32560-05.html"; // TODO this html should most probably be different
  94. break;
  95. case 2:
  96. htmltext = "32560-06.html";
  97. break;
  98. case 3:
  99. htmltext = "32560-07.html";
  100. break;
  101. case 4:
  102. htmltext = "32560-08.html";
  103. st.giveAdena(62516, true);
  104. st.addExpAndSp(377403, 37867);
  105. st.exitQuest(false, true);
  106. break;
  107. }
  108. break;
  109. case State.COMPLETED:
  110. htmltext = "32560-03.html";
  111. break;
  112. }
  113. break;
  114. case EL:
  115. if (st.isCompleted())
  116. {
  117. htmltext = "32556-02.html";
  118. }
  119. else if (st.isStarted())
  120. {
  121. switch (st.getCond())
  122. {
  123. case 1:
  124. htmltext = "32556-01.html";
  125. break;
  126. case 2:
  127. htmltext = "32556-07.html";
  128. break;
  129. case 3:
  130. htmltext = "32556-08.html";
  131. break;
  132. case 4:
  133. htmltext = "32556-09.html";
  134. break;
  135. }
  136. }
  137. break;
  138. case MEDIBAL_CORPSE:
  139. if (st.isCompleted())
  140. {
  141. htmltext = "32528-02.html";
  142. }
  143. else if (st.isStarted())
  144. {
  145. switch (st.getCond())
  146. {
  147. case 2:
  148. htmltext = "32528-01.html";
  149. st.setCond(3, true);
  150. st.giveItems(MEDIBAL_DOCUMENT, 1);
  151. break;
  152. case 3:
  153. case 4:
  154. htmltext = "32528-03.html";
  155. break;
  156. }
  157. }
  158. break;
  159. }
  160. return htmltext;
  161. }
  162. }