Q00629_CleanUpTheSwampOfScreams.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.Q00629_CleanUpTheSwampOfScreams;
  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. * Clean Up The Swamp Of Screams (629)
  28. * @author netvirus
  29. */
  30. public final class Q00629_CleanUpTheSwampOfScreams extends Quest
  31. {
  32. // NPC
  33. private static final int PIERCE = 31553;
  34. // Items
  35. private static final int TALON_OF_STAKATO = 7250;
  36. private static final int GOLDEN_RAM_COIN = 7251;
  37. // Misc
  38. private static final int REQUIRED_TALON_COUNT = 100;
  39. private static final int MIN_LVL = 66;
  40. // Mobs
  41. private static final Map<Integer, Double> MOBS_DROP_CHANCES = new HashMap<>();
  42. static
  43. {
  44. MOBS_DROP_CHANCES.put(21508, 0.599); // splinter_stakato
  45. MOBS_DROP_CHANCES.put(21509, 0.524); // splinter_stakato_worker
  46. MOBS_DROP_CHANCES.put(21510, 0.640); // splinter_stakato_soldier
  47. MOBS_DROP_CHANCES.put(21511, 0.830); // splinter_stakato_drone
  48. MOBS_DROP_CHANCES.put(21512, 0.970); // splinter_stakato_drone_a
  49. MOBS_DROP_CHANCES.put(21513, 0.682); // needle_stakato
  50. MOBS_DROP_CHANCES.put(21514, 0.595); // needle_stakato_worker
  51. MOBS_DROP_CHANCES.put(21515, 0.727); // needle_stakato_soldier
  52. MOBS_DROP_CHANCES.put(21516, 0.879); // needle_stakato_drone
  53. MOBS_DROP_CHANCES.put(21517, 0.999); // needle_stakato_drone_a
  54. }
  55. public Q00629_CleanUpTheSwampOfScreams()
  56. {
  57. super(629, Q00629_CleanUpTheSwampOfScreams.class.getSimpleName(), "Clean Up The Swamp Of Screams");
  58. addStartNpc(PIERCE);
  59. addTalkId(PIERCE);
  60. addKillId(MOBS_DROP_CHANCES.keySet());
  61. registerQuestItems(TALON_OF_STAKATO, GOLDEN_RAM_COIN);
  62. }
  63. @Override
  64. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  65. {
  66. final QuestState qs = getQuestState(player, false);
  67. String htmltext = null;
  68. if (qs == null)
  69. {
  70. return htmltext;
  71. }
  72. switch (event)
  73. {
  74. case "31553-03.htm":
  75. {
  76. if (qs.isCreated())
  77. {
  78. qs.startQuest();
  79. htmltext = event;
  80. }
  81. break;
  82. }
  83. case "31553-04.html":
  84. case "31553-06.html":
  85. {
  86. if (qs.isStarted())
  87. {
  88. htmltext = event;
  89. }
  90. break;
  91. }
  92. case "31553-07.html":
  93. {
  94. if (qs.isStarted() && (getQuestItemsCount(player, TALON_OF_STAKATO) >= REQUIRED_TALON_COUNT))
  95. {
  96. rewardItems(player, GOLDEN_RAM_COIN, 20);
  97. takeItems(player, TALON_OF_STAKATO, 100);
  98. htmltext = event;
  99. }
  100. else
  101. {
  102. htmltext = "31553-08.html";
  103. }
  104. break;
  105. }
  106. case "31553-09.html":
  107. {
  108. if (qs.isStarted())
  109. {
  110. qs.exitQuest(true, true);
  111. htmltext = event;
  112. }
  113. break;
  114. }
  115. }
  116. return htmltext;
  117. }
  118. @Override
  119. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  120. {
  121. final QuestState qs = getRandomPartyMemberState(killer, -1, 2, npc);
  122. if (qs != null)
  123. {
  124. giveItemRandomly(qs.getPlayer(), npc, TALON_OF_STAKATO, 1, 0, MOBS_DROP_CHANCES.get(npc.getId()), true);
  125. }
  126. return super.onKill(npc, killer, isSummon);
  127. }
  128. @Override
  129. public String onTalk(L2Npc npc, L2PcInstance player)
  130. {
  131. final QuestState qs = getQuestState(player, true);
  132. String htmltext = getNoQuestMsg(player);
  133. if (qs == null)
  134. {
  135. return htmltext;
  136. }
  137. if (qs.isCreated())
  138. {
  139. htmltext = ((player.getLevel() >= MIN_LVL) ? "31553-01.htm" : "31553-02.htm");
  140. }
  141. else if (qs.isStarted())
  142. {
  143. htmltext = ((getQuestItemsCount(player, TALON_OF_STAKATO) >= REQUIRED_TALON_COUNT) ? "31553-04.html" : "31553-05.html");
  144. }
  145. return htmltext;
  146. }
  147. }