Q00319_ScentOfDeath.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.Q00319_ScentOfDeath;
  20. import com.l2jserver.gameserver.enums.QuestSound;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.holders.ItemHolder;
  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. import com.l2jserver.gameserver.util.Util;
  28. /**
  29. * Scent of Death (319)
  30. * @author Zoey76
  31. */
  32. public class Q00319_ScentOfDeath extends Quest
  33. {
  34. // NPC
  35. private static final int MINALESS = 30138;
  36. // Monsters
  37. private static final int MARSH_ZOMBIE = 20015;
  38. private static final int MARSH_ZOMBIE_LORD = 20020;
  39. // Item
  40. private static final int ZOMBIES_SKIN = 1045;
  41. private static final ItemHolder LESSER_HEALING_POTION = new ItemHolder(1060, 1);
  42. // Misc
  43. private static final int MIN_LEVEL = 11;
  44. private static final int MIN_CHANCE = 7;
  45. private static final int REQUIRED_ITEM_COUNT = 5;
  46. public Q00319_ScentOfDeath()
  47. {
  48. super(319, Q00319_ScentOfDeath.class.getSimpleName(), "Scent of Death");
  49. addStartNpc(MINALESS);
  50. addTalkId(MINALESS);
  51. addKillId(MARSH_ZOMBIE, MARSH_ZOMBIE_LORD);
  52. registerQuestItems(ZOMBIES_SKIN);
  53. }
  54. @Override
  55. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  56. {
  57. final QuestState st = getQuestState(player, false);
  58. if (st == null)
  59. {
  60. return null;
  61. }
  62. String htmltext = null;
  63. if (player.getLevel() >= MIN_LEVEL)
  64. {
  65. switch (event)
  66. {
  67. case "30138-04.htm":
  68. {
  69. st.startQuest();
  70. htmltext = event;
  71. break;
  72. }
  73. }
  74. }
  75. return htmltext;
  76. }
  77. @Override
  78. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  79. {
  80. final QuestState st = getQuestState(killer, false);
  81. if ((st != null) && Util.checkIfInRange(1500, npc, killer, false) && (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT))
  82. {
  83. if (getRandom(10) > MIN_CHANCE)
  84. {
  85. st.giveItems(ZOMBIES_SKIN, 1);
  86. if (st.getQuestItemsCount(ZOMBIES_SKIN) < REQUIRED_ITEM_COUNT)
  87. {
  88. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  89. }
  90. else
  91. {
  92. st.setCond(2, true);
  93. }
  94. }
  95. }
  96. return super.onKill(npc, killer, isSummon);
  97. }
  98. @Override
  99. public String onTalk(L2Npc npc, L2PcInstance player)
  100. {
  101. final QuestState st = getQuestState(player, true);
  102. if (st == null)
  103. {
  104. return getNoQuestMsg(player);
  105. }
  106. String htmltext = getNoQuestMsg(player);
  107. switch (st.getState())
  108. {
  109. case State.CREATED:
  110. {
  111. htmltext = player.getLevel() >= MIN_LEVEL ? "30138-03.htm" : "30138-02.htm";
  112. break;
  113. }
  114. case State.STARTED:
  115. {
  116. switch (st.getCond())
  117. {
  118. case 1:
  119. {
  120. htmltext = "30138-05.html";
  121. break;
  122. }
  123. case 2:
  124. {
  125. st.giveAdena(3350, false);
  126. st.giveItems(LESSER_HEALING_POTION);
  127. st.takeItems(ZOMBIES_SKIN, -1);
  128. st.exitQuest(true, true);
  129. htmltext = "30138-06.html";
  130. break;
  131. }
  132. }
  133. break;
  134. }
  135. }
  136. return htmltext;
  137. }
  138. }