Q00268_TracesOfEvil.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.Q00268_TracesOfEvil;
  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.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * Traces of Evil (268)
  28. * @author xban1x
  29. */
  30. public final class Q00268_TracesOfEvil extends Quest
  31. {
  32. // NPC
  33. private static final int KUNAI = 30559;
  34. // Item
  35. private static final int CONTAMINATED_KASHA_SPIDER_VENOM = 10869;
  36. // Monsters
  37. private static final int[] MONSTERS = new int[]
  38. {
  39. 20474, // Kasha Spider
  40. 20476, // Kasha Fang Spider
  41. 20478, // Kasha Blade Spider
  42. };
  43. // Misc
  44. private static final int MIN_LVL = 15;
  45. public Q00268_TracesOfEvil()
  46. {
  47. super(268, Q00268_TracesOfEvil.class.getSimpleName(), "Traces of Evil");
  48. addStartNpc(KUNAI);
  49. addTalkId(KUNAI);
  50. addKillId(MONSTERS);
  51. registerQuestItems(CONTAMINATED_KASHA_SPIDER_VENOM);
  52. }
  53. @Override
  54. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  55. {
  56. final QuestState st = getQuestState(player, false);
  57. if ((st != null) && event.equalsIgnoreCase("30559-03.htm"))
  58. {
  59. st.startQuest();
  60. return event;
  61. }
  62. return null;
  63. }
  64. @Override
  65. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  66. {
  67. final QuestState st = getQuestState(killer, false);
  68. if ((st != null) && st.isCond(1))
  69. {
  70. st.giveItems(CONTAMINATED_KASHA_SPIDER_VENOM, 1);
  71. if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30)
  72. {
  73. st.setCond(2, true);
  74. }
  75. else
  76. {
  77. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  78. }
  79. }
  80. return super.onKill(npc, killer, isSummon);
  81. }
  82. @Override
  83. public String onTalk(L2Npc npc, L2PcInstance player)
  84. {
  85. final QuestState st = getQuestState(player, true);
  86. String htmltext = getNoQuestMsg(player);
  87. if (st != null)
  88. {
  89. switch (st.getState())
  90. {
  91. case State.CREATED:
  92. {
  93. htmltext = (player.getLevel() >= MIN_LVL) ? "30559-02.htm" : "30559-01.htm";
  94. break;
  95. }
  96. case State.STARTED:
  97. {
  98. switch (st.getCond())
  99. {
  100. case 1:
  101. {
  102. htmltext = (!st.hasQuestItems(CONTAMINATED_KASHA_SPIDER_VENOM)) ? "30559-04.html" : "30559-05.html";
  103. break;
  104. }
  105. case 2:
  106. {
  107. if (st.getQuestItemsCount(CONTAMINATED_KASHA_SPIDER_VENOM) >= 30)
  108. {
  109. st.giveAdena(2474, true);
  110. st.addExpAndSp(8738, 409);
  111. st.exitQuest(true, true);
  112. htmltext = "30559-06.html";
  113. }
  114. break;
  115. }
  116. }
  117. break;
  118. }
  119. }
  120. }
  121. return htmltext;
  122. }
  123. }