Q10288_SecretMission.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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.Q10288_SecretMission;
  20. import com.l2jserver.gameserver.model.Location;
  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. * Secret Mission (10288)
  28. * @author Gnacik
  29. */
  30. public class Q10288_SecretMission extends Quest
  31. {
  32. // NPCs
  33. private static final int DOMINIC = 31350;
  34. private static final int AQUILANI = 32780;
  35. private static final int GREYMORE = 32757;
  36. // Item
  37. private static final int LETTER = 15529;
  38. // Location
  39. private static final Location TELEPORT = new Location(118833, -80589, -2688);
  40. public Q10288_SecretMission()
  41. {
  42. super(10288, Q10288_SecretMission.class.getSimpleName(), "Secret Mission");
  43. addStartNpc(AQUILANI, DOMINIC);
  44. addFirstTalkId(AQUILANI);
  45. addTalkId(DOMINIC, GREYMORE, AQUILANI);
  46. registerQuestItems(LETTER);
  47. }
  48. @Override
  49. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  50. {
  51. QuestState st = getQuestState(player, false);
  52. if (st == null)
  53. {
  54. return getNoQuestMsg(player);
  55. }
  56. String htmltext = event;
  57. switch (event)
  58. {
  59. case "31350-03.html":
  60. if (player.getLevel() < 82)
  61. {
  62. htmltext = "31350-02b.html";
  63. }
  64. break;
  65. case "31350-05.htm":
  66. st.startQuest();
  67. st.giveItems(LETTER, 1);
  68. break;
  69. case "32780-03.html":
  70. if (st.isCond(1) && st.hasQuestItems(LETTER))
  71. {
  72. st.setCond(2, true);
  73. }
  74. break;
  75. case "32757-03.html":
  76. if (st.isCond(2) && st.hasQuestItems(LETTER))
  77. {
  78. st.giveAdena(106583, true);
  79. st.addExpAndSp(417788, 46320);
  80. st.exitQuest(false, true);
  81. }
  82. break;
  83. case "teleport":
  84. if ((npc.getId() == AQUILANI) && st.isCompleted())
  85. {
  86. player.teleToLocation(TELEPORT);
  87. return null;
  88. }
  89. }
  90. return htmltext;
  91. }
  92. @Override
  93. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  94. {
  95. QuestState st = getQuestState(player, false);
  96. // dialog only changes when you talk to Aquilani after quest completion
  97. if ((st != null) && st.isCompleted())
  98. {
  99. return "32780-05.html";
  100. }
  101. return "data/html/default/32780.htm";
  102. }
  103. @Override
  104. public String onTalk(L2Npc npc, L2PcInstance player)
  105. {
  106. String htmltext = getNoQuestMsg(player);
  107. final QuestState st = getQuestState(player, true);
  108. if (st == null)
  109. {
  110. return htmltext;
  111. }
  112. switch (npc.getId())
  113. {
  114. case DOMINIC:
  115. switch (st.getState())
  116. {
  117. case State.CREATED:
  118. htmltext = "31350-01.htm";
  119. break;
  120. case State.STARTED:
  121. if (st.isCond(1))
  122. {
  123. htmltext = "31350-06.html";
  124. }
  125. break;
  126. case State.COMPLETED:
  127. htmltext = "31350-07.html";
  128. break;
  129. }
  130. break;
  131. case AQUILANI:
  132. if (st.isStarted())
  133. {
  134. if (st.isCond(1) && st.hasQuestItems(LETTER))
  135. {
  136. htmltext = "32780-01.html";
  137. }
  138. else if (st.isCond(2))
  139. {
  140. htmltext = "32780-04.html";
  141. }
  142. }
  143. break;
  144. case GREYMORE:
  145. if (st.isStarted() && st.isCond(2) && st.hasQuestItems(LETTER))
  146. {
  147. return "32757-01.html";
  148. }
  149. break;
  150. }
  151. return htmltext;
  152. }
  153. }