Q00119_LastImperialPrince.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.Q00119_LastImperialPrince;
  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. * Last Imperial Prince (119)
  27. * @author Adry_85
  28. */
  29. public class Q00119_LastImperialPrince extends Quest
  30. {
  31. // NPCs
  32. private static final int NAMELESS_SPIRIT = 31453;
  33. private static final int DEVORIN = 32009;
  34. // Item
  35. private static final int ANTIQUE_BROOCH = 7262;
  36. // Misc
  37. private static final int MIN_LEVEL = 74;
  38. public Q00119_LastImperialPrince()
  39. {
  40. super(119, Q00119_LastImperialPrince.class.getSimpleName(), "Last Imperial Prince");
  41. addStartNpc(NAMELESS_SPIRIT);
  42. addTalkId(NAMELESS_SPIRIT, DEVORIN);
  43. }
  44. @Override
  45. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  46. {
  47. final QuestState st = getQuestState(player, false);
  48. if (st == null)
  49. {
  50. return null;
  51. }
  52. String htmltext = null;
  53. switch (event)
  54. {
  55. case "31453-02.htm":
  56. case "31453-03.htm":
  57. case "31453-10.html":
  58. {
  59. htmltext = event;
  60. break;
  61. }
  62. case "31453-04.html":
  63. {
  64. st.startQuest();
  65. htmltext = event;
  66. break;
  67. }
  68. case "31453-11.html":
  69. {
  70. if (st.isCond(2))
  71. {
  72. st.giveAdena(150292, true);
  73. st.addExpAndSp(902439, 90067);
  74. st.exitQuest(false, true);
  75. htmltext = event;
  76. }
  77. break;
  78. }
  79. case "brooch":
  80. {
  81. htmltext = (st.hasQuestItems(ANTIQUE_BROOCH)) ? "32009-02.html" : "32009-03.html";
  82. break;
  83. }
  84. case "32009-04.html":
  85. {
  86. if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH))
  87. {
  88. st.setCond(2, true);
  89. htmltext = event;
  90. }
  91. break;
  92. }
  93. }
  94. return htmltext;
  95. }
  96. @Override
  97. public String onTalk(L2Npc npc, L2PcInstance player)
  98. {
  99. final QuestState st = getQuestState(player, true);
  100. String htmltext = getNoQuestMsg(player);
  101. if (st == null)
  102. {
  103. return htmltext;
  104. }
  105. switch (st.getState())
  106. {
  107. case State.COMPLETED:
  108. {
  109. if (npc.getId() == NAMELESS_SPIRIT)
  110. {
  111. htmltext = "31453-06.html";
  112. }
  113. break;
  114. }
  115. case State.CREATED:
  116. {
  117. htmltext = ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(ANTIQUE_BROOCH)) ? "31453-01.htm" : "31453-05.html";
  118. break;
  119. }
  120. case State.STARTED:
  121. {
  122. if (npc.getId() == NAMELESS_SPIRIT)
  123. {
  124. if (st.isCond(1))
  125. {
  126. if (st.hasQuestItems(ANTIQUE_BROOCH))
  127. {
  128. htmltext = "31453-07.html";
  129. }
  130. else
  131. {
  132. htmltext = "31453-08.html";
  133. st.exitQuest(true);
  134. }
  135. }
  136. else if (st.isCond(2))
  137. {
  138. htmltext = "31453-09.html";
  139. }
  140. }
  141. else if (npc.getId() == DEVORIN)
  142. {
  143. if (st.isCond(1))
  144. {
  145. htmltext = "32009-01.html";
  146. }
  147. else if (st.isCond(2))
  148. {
  149. htmltext = "32009-05.html";
  150. }
  151. }
  152. break;
  153. }
  154. }
  155. return htmltext;
  156. }
  157. }