Q00385_YokeOfThePast.java 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.Q00385_YokeOfThePast;
  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. import com.l2jserver.gameserver.model.quest.State;
  27. /**
  28. * Yoke of the Past (385)
  29. * @author Pandragon
  30. */
  31. public final class Q00385_YokeOfThePast extends Quest
  32. {
  33. // NPCs
  34. // @formatter:off
  35. private static final int[] ZIGGURATS =
  36. {
  37. 31095, 31096, 31097, 31098, 31099, 31100, 31101,
  38. 31102, 31103, 31104, 31105, 31106, 31107, 31108,
  39. 31109, 31110, 31114, 31115, 31116, 31117, 31118,
  40. 31119, 31120, 31121, 31122, 31123, 31124, 31125
  41. };
  42. // @formatter:on
  43. // Item
  44. private static final int SCROLL_OF_ANCIENT_MAGIC = 5902;
  45. // Reward
  46. private static final int BLANK_SCROLL = 5965;
  47. // Monsters
  48. private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
  49. {
  50. MONSTER_CHANCES.put(21144, 0.306); // Catacomb Shadow
  51. MONSTER_CHANCES.put(21156, 0.994); // Purgatory Shadow
  52. MONSTER_CHANCES.put(21208, 0.146); // Hallowed Watchman
  53. MONSTER_CHANCES.put(21209, 0.166); // Hallowed Seer
  54. MONSTER_CHANCES.put(21210, 0.202); // Vault Guardian
  55. MONSTER_CHANCES.put(21211, 0.212); // Vault Seer
  56. MONSTER_CHANCES.put(21213, 0.274); // Hallowed Monk
  57. MONSTER_CHANCES.put(21214, 0.342); // Vault Sentinel
  58. MONSTER_CHANCES.put(21215, 0.360); // Vault Monk
  59. MONSTER_CHANCES.put(21217, 0.460); // Hallowed Priest
  60. MONSTER_CHANCES.put(21218, 0.558); // Vault Overlord
  61. MONSTER_CHANCES.put(21219, 0.578); // Vault Priest
  62. MONSTER_CHANCES.put(21221, 0.710); // Sepulcher Inquisitor
  63. MONSTER_CHANCES.put(21222, 0.842); // Sepulcher Archon
  64. MONSTER_CHANCES.put(21223, 0.862); // Sepulcher Inquisitor
  65. MONSTER_CHANCES.put(21224, 0.940); // Sepulcher Guardian
  66. MONSTER_CHANCES.put(21225, 0.970); // Sepulcher Sage
  67. MONSTER_CHANCES.put(21226, 0.202); // Sepulcher Guardian
  68. MONSTER_CHANCES.put(21227, 0.290); // Sepulcher Sage
  69. MONSTER_CHANCES.put(21228, 0.316); // Sepulcher Guard
  70. MONSTER_CHANCES.put(21229, 0.426); // Sepulcher Preacher
  71. MONSTER_CHANCES.put(21230, 0.646); // Sepulcher Guard
  72. MONSTER_CHANCES.put(21231, 0.654); // Sepulcher Preacher
  73. MONSTER_CHANCES.put(21236, 0.238); // Barrow Sentinel
  74. MONSTER_CHANCES.put(21237, 0.274); // Barrow Monk
  75. MONSTER_CHANCES.put(21238, 0.342); // Grave Sentinel
  76. MONSTER_CHANCES.put(21239, 0.360); // Grave Monk
  77. MONSTER_CHANCES.put(21240, 0.410); // Barrow Overlord
  78. MONSTER_CHANCES.put(21241, 0.460); // Barrow Priest
  79. MONSTER_CHANCES.put(21242, 0.558); // Grave Overlord
  80. MONSTER_CHANCES.put(21243, 0.578); // Grave Priest
  81. MONSTER_CHANCES.put(21244, 0.642); // Crypt Archon
  82. MONSTER_CHANCES.put(21245, 0.700); // Crypt Inquisitor
  83. MONSTER_CHANCES.put(21246, 0.842); // Tomb Archon
  84. MONSTER_CHANCES.put(21247, 0.862); // Tomb Inquisitor
  85. MONSTER_CHANCES.put(21248, 0.940); // Crypt Guardian
  86. MONSTER_CHANCES.put(21249, 0.970); // Crypt Sage
  87. MONSTER_CHANCES.put(21250, 0.798); // Tomb Guardian
  88. MONSTER_CHANCES.put(21251, 0.710); // Tomb Sage
  89. MONSTER_CHANCES.put(21252, 0.684); // Crypt Guard
  90. MONSTER_CHANCES.put(21253, 0.574); // Crypt Preacher
  91. MONSTER_CHANCES.put(21254, 0.354); // Tomb Guard
  92. MONSTER_CHANCES.put(21255, 0.250); // Tomb Preacher
  93. }
  94. // Misc
  95. private static final int MIN_LVL = 20;
  96. public Q00385_YokeOfThePast()
  97. {
  98. super(385, Q00385_YokeOfThePast.class.getSimpleName(), "Yoke of the Past");
  99. addStartNpc(ZIGGURATS);
  100. addTalkId(ZIGGURATS);
  101. addKillId(MONSTER_CHANCES.keySet());
  102. registerQuestItems(SCROLL_OF_ANCIENT_MAGIC);
  103. }
  104. @Override
  105. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  106. {
  107. final QuestState qs = getQuestState(player, false);
  108. String htmltext = null;
  109. if (qs != null)
  110. {
  111. switch (event)
  112. {
  113. case "ziggurat-03.htm":
  114. case "ziggurat-04.htm":
  115. case "ziggurat-06.htm":
  116. case "ziggurat-07.htm":
  117. {
  118. htmltext = event;
  119. break;
  120. }
  121. case "ziggurat-05.htm":
  122. {
  123. if (qs.isCreated())
  124. {
  125. qs.startQuest();
  126. htmltext = event;
  127. }
  128. break;
  129. }
  130. case "ziggurat-10.html":
  131. {
  132. qs.exitQuest(true, true);
  133. htmltext = event;
  134. break;
  135. }
  136. }
  137. }
  138. return htmltext;
  139. }
  140. @Override
  141. public String onTalk(L2Npc npc, L2PcInstance talker)
  142. {
  143. final QuestState qs = getQuestState(talker, true);
  144. String htmltext = getNoQuestMsg(talker);
  145. switch (qs.getState())
  146. {
  147. case State.CREATED:
  148. {
  149. htmltext = (talker.getLevel() >= MIN_LVL) ? "ziggurat-01.htm" : "ziggurat-02.htm";
  150. break;
  151. }
  152. case State.STARTED:
  153. {
  154. if (hasQuestItems(talker, SCROLL_OF_ANCIENT_MAGIC))
  155. {
  156. rewardItems(talker, BLANK_SCROLL, getQuestItemsCount(talker, SCROLL_OF_ANCIENT_MAGIC));
  157. takeItems(talker, SCROLL_OF_ANCIENT_MAGIC, -1);
  158. htmltext = "ziggurat-09.html";
  159. }
  160. else
  161. {
  162. htmltext = "ziggurat-08.html";
  163. }
  164. break;
  165. }
  166. }
  167. return htmltext;
  168. }
  169. @Override
  170. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  171. {
  172. final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
  173. if (qs != null)
  174. {
  175. giveItemRandomly(qs.getPlayer(), npc, SCROLL_OF_ANCIENT_MAGIC, 1, 0, MONSTER_CHANCES.get(npc.getId()), true);
  176. }
  177. return super.onKill(npc, killer, isSummon);
  178. }
  179. }