Q00164_BloodFiend.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.Q00164_BloodFiend;
  20. import com.l2jserver.gameserver.enums.Race;
  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. import com.l2jserver.gameserver.network.NpcStringId;
  27. import com.l2jserver.gameserver.network.clientpackets.Say2;
  28. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  29. /**
  30. * Blood Fiend (164)
  31. * @author xban1x
  32. */
  33. public class Q00164_BloodFiend extends Quest
  34. {
  35. // NPC
  36. private static final int CREAMEES = 30149;
  37. // Monster
  38. private static final int KIRUNAK = 27021;
  39. // Item
  40. private static final int KIRUNAK_SKULL = 1044;
  41. // Misc
  42. private static final int MIN_LVL = 21;
  43. public Q00164_BloodFiend()
  44. {
  45. super(164, Q00164_BloodFiend.class.getSimpleName(), "Blood Fiend");
  46. addStartNpc(CREAMEES);
  47. addTalkId(CREAMEES);
  48. addKillId(KIRUNAK);
  49. registerQuestItems(KIRUNAK_SKULL);
  50. }
  51. @Override
  52. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  53. {
  54. final QuestState st = getQuestState(player, false);
  55. if ((st != null) && event.equals("30149-04.htm"))
  56. {
  57. st.startQuest();
  58. return event;
  59. }
  60. return null;
  61. }
  62. @Override
  63. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  64. {
  65. final QuestState st = getQuestState(killer, false);
  66. if ((st != null) && st.isCond(1))
  67. {
  68. npc.broadcastPacket(new NpcSay(npc, Say2.ALL, NpcStringId.I_HAVE_FULFILLED_MY_CONTRACT_WITH_TRADER_CREAMEES));
  69. st.giveItems(KIRUNAK_SKULL, 1);
  70. st.setCond(2, true);
  71. }
  72. return super.onKill(npc, killer, isSummon);
  73. }
  74. @Override
  75. public String onTalk(L2Npc npc, L2PcInstance player)
  76. {
  77. final QuestState st = getQuestState(player, true);
  78. String htmltext = getNoQuestMsg(player);
  79. if (st != null)
  80. {
  81. switch (st.getState())
  82. {
  83. case State.CREATED:
  84. {
  85. htmltext = (player.getRace() != Race.DARK_ELF) ? player.getLevel() >= MIN_LVL ? "30149-03.htm" : "30149-02.htm" : "30149-00.htm";
  86. break;
  87. }
  88. case State.STARTED:
  89. {
  90. if (st.isCond(2) && st.hasQuestItems(KIRUNAK_SKULL))
  91. {
  92. st.giveAdena(42130, true);
  93. st.addExpAndSp(35637, 1854);
  94. st.exitQuest(false, true);
  95. htmltext = "30149-06.html";
  96. }
  97. else
  98. {
  99. htmltext = "30149-05.html";
  100. }
  101. break;
  102. }
  103. case State.COMPLETED:
  104. {
  105. htmltext = getAlreadyCompletedMsg(player);
  106. break;
  107. }
  108. }
  109. }
  110. return htmltext;
  111. }
  112. }