Q00170_DangerousSeduction.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.Q00170_DangerousSeduction;
  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. * Dangerous Seduction (170)
  31. * @author malyelfik
  32. */
  33. public class Q00170_DangerousSeduction extends Quest
  34. {
  35. // NPC
  36. private static final int VELLIOR = 30305;
  37. // Monster
  38. private static final int MERKENIS = 27022;
  39. // Item
  40. private static final int NIGHTMARE_CRYSTAL = 1046;
  41. // Misc
  42. private static final int MIN_LEVEL = 21;
  43. public Q00170_DangerousSeduction()
  44. {
  45. super(170, Q00170_DangerousSeduction.class.getSimpleName(), "Dangerous Seduction");
  46. addStartNpc(VELLIOR);
  47. addTalkId(VELLIOR);
  48. addKillId(MERKENIS);
  49. registerQuestItems(NIGHTMARE_CRYSTAL);
  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)
  56. {
  57. return null;
  58. }
  59. if (event.equalsIgnoreCase("30305-04.htm"))
  60. {
  61. st.startQuest();
  62. return event;
  63. }
  64. return null;
  65. }
  66. @Override
  67. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  68. {
  69. final QuestState st = getQuestState(player, false);
  70. if ((st != null) && st.isCond(1))
  71. {
  72. st.setCond(2, true);
  73. st.giveItems(NIGHTMARE_CRYSTAL, 1);
  74. npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.SEND_MY_SOUL_TO_LICH_KING_ICARUS));
  75. }
  76. return super.onKill(npc, player, isSummon);
  77. }
  78. @Override
  79. public String onTalk(L2Npc npc, L2PcInstance player)
  80. {
  81. String htmltext = getNoQuestMsg(player);
  82. final QuestState st = getQuestState(player, true);
  83. if (st == null)
  84. {
  85. return htmltext;
  86. }
  87. switch (st.getState())
  88. {
  89. case State.CREATED:
  90. htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LEVEL) ? "30305-01.htm" : "30305-02.htm" : "30305-03.htm";
  91. break;
  92. case State.STARTED:
  93. if (st.isCond(1))
  94. {
  95. htmltext = "30305-05.html";
  96. }
  97. else
  98. {
  99. st.giveAdena(102680, true);
  100. st.addExpAndSp(38607, 4018);
  101. st.exitQuest(false, true);
  102. htmltext = "30305-06.html";
  103. }
  104. break;
  105. case State.COMPLETED:
  106. htmltext = getAlreadyCompletedMsg(player);
  107. break;
  108. }
  109. return htmltext;
  110. }
  111. }