Q00026_TiredOfWaiting.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.Q00026_TiredOfWaiting;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. /**
  27. * Tired Of Waiting (26)
  28. * @author corbin12
  29. */
  30. public final class Q00026_TiredOfWaiting extends Quest
  31. {
  32. // NPCs
  33. private static final int ISAEL_SILVERSHADOW = 30655;
  34. private static final int KITZKA = 31045;
  35. // Items
  36. private static final int DELIVERY_BOX = 17281;
  37. private static final Map<String, Integer> REWARDS = new HashMap<>();
  38. static
  39. {
  40. REWARDS.put("31045-10.html", 17248); // Large Dragon Bone
  41. REWARDS.put("31045-11.html", 17266); // Will of Antharas
  42. REWARDS.put("31045-12.html", 17267); // Sealed Blood Crystal
  43. }
  44. public Q00026_TiredOfWaiting()
  45. {
  46. super(26, Q00026_TiredOfWaiting.class.getSimpleName(), "Tired of Waiting");
  47. addStartNpc(ISAEL_SILVERSHADOW);
  48. addTalkId(ISAEL_SILVERSHADOW, KITZKA);
  49. registerQuestItems(DELIVERY_BOX);
  50. }
  51. @Override
  52. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  53. {
  54. String htmltext = null;
  55. final QuestState st = getQuestState(player, false);
  56. if (st == null)
  57. {
  58. return htmltext;
  59. }
  60. switch (event)
  61. {
  62. case "30655-02.htm":
  63. case "30655-03.htm":
  64. case "30655-05.html":
  65. case "30655-06.html":
  66. case "31045-02.html":
  67. case "31045-03.html":
  68. case "31045-05.html":
  69. case "31045-06.html":
  70. case "31045-07.html":
  71. case "31045-08.html":
  72. case "31045-09.html":
  73. htmltext = event;
  74. break;
  75. case "30655-04.html":
  76. if (st.isCreated())
  77. {
  78. st.giveItems(DELIVERY_BOX, 1);
  79. st.startQuest();
  80. htmltext = event;
  81. }
  82. break;
  83. case "31045-04.html":
  84. if (st.isStarted())
  85. {
  86. st.takeItems(DELIVERY_BOX, -1);
  87. htmltext = event;
  88. }
  89. break;
  90. case "31045-10.html":
  91. case "31045-11.html":
  92. case "31045-12.html":
  93. if (st.isStarted())
  94. {
  95. st.giveItems(REWARDS.get(event), 1);
  96. st.exitQuest(false, true);
  97. htmltext = event;
  98. }
  99. break;
  100. }
  101. return htmltext;
  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 ISAEL_SILVERSHADOW:
  115. if (st.isCreated())
  116. {
  117. htmltext = ((player.getLevel() >= 80) ? "30655-01.htm" : "30655-00.html");
  118. }
  119. else if (st.isStarted())
  120. {
  121. htmltext = "30655-07.html";
  122. }
  123. else
  124. {
  125. htmltext = "30655-08.html";
  126. }
  127. break;
  128. case KITZKA:
  129. if (st.isStarted())
  130. {
  131. htmltext = (st.hasQuestItems(DELIVERY_BOX) ? "31045-01.html" : "31045-09.html");
  132. }
  133. break;
  134. }
  135. return htmltext;
  136. }
  137. }