Q00109_InSearchOfTheNest.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.Q00109_InSearchOfTheNest;
  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. * In Search of the Nest (109)
  27. * @author Adry_85
  28. */
  29. public class Q00109_InSearchOfTheNest extends Quest
  30. {
  31. // NPCs
  32. private static final int PIERCE = 31553;
  33. private static final int SCOUTS_CORPSE = 32015;
  34. private static final int KAHMAN = 31554;
  35. // Items
  36. private static final int SCOUTS_NOTE = 14858;
  37. public Q00109_InSearchOfTheNest()
  38. {
  39. super(109, Q00109_InSearchOfTheNest.class.getSimpleName(), "In Search of the Nest");
  40. addStartNpc(PIERCE);
  41. addTalkId(PIERCE, SCOUTS_CORPSE, KAHMAN);
  42. registerQuestItems(SCOUTS_NOTE);
  43. }
  44. @Override
  45. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  46. {
  47. QuestState st = getQuestState(player, false);
  48. if (st == null)
  49. {
  50. return getNoQuestMsg(player);
  51. }
  52. switch (event)
  53. {
  54. case "31553-0.htm":
  55. st.startQuest();
  56. break;
  57. case "32015-2.html":
  58. st.giveItems(SCOUTS_NOTE, 1);
  59. st.setCond(2, true);
  60. break;
  61. case "31553-3.html":
  62. st.takeItems(SCOUTS_NOTE, -1);
  63. st.setCond(3, true);
  64. break;
  65. case "31554-2.html":
  66. st.giveAdena(161500, true);
  67. st.addExpAndSp(701500, 50000);
  68. st.exitQuest(false, true);
  69. break;
  70. }
  71. return event;
  72. }
  73. @Override
  74. public String onTalk(L2Npc npc, L2PcInstance player)
  75. {
  76. String htmltext = getNoQuestMsg(player);
  77. final QuestState st = getQuestState(player, true);
  78. if (st == null)
  79. {
  80. return htmltext;
  81. }
  82. switch (npc.getId())
  83. {
  84. case PIERCE:
  85. switch (st.getState())
  86. {
  87. case State.CREATED:
  88. htmltext = (player.getLevel() < 81) ? "31553-0a.htm" : "31553-0b.htm";
  89. break;
  90. case State.STARTED:
  91. switch (st.getInt("cond"))
  92. {
  93. case 1:
  94. htmltext = "31553-1.html";
  95. break;
  96. case 2:
  97. htmltext = "31553-2.html";
  98. break;
  99. case 3:
  100. htmltext = "31553-3a.html";
  101. break;
  102. }
  103. break;
  104. case State.COMPLETED:
  105. htmltext = getAlreadyCompletedMsg(player);
  106. break;
  107. }
  108. break;
  109. case SCOUTS_CORPSE:
  110. if (st.isStarted())
  111. {
  112. if (st.isCond(1))
  113. {
  114. htmltext = "32015-1.html";
  115. }
  116. else if (st.isCond(2))
  117. {
  118. htmltext = "32015-3.html";
  119. }
  120. }
  121. break;
  122. case KAHMAN:
  123. if (st.isStarted() && st.isCond(3))
  124. {
  125. htmltext = "31554-1.html";
  126. }
  127. break;
  128. }
  129. return htmltext;
  130. }
  131. }