Q00015_SweetWhispers.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.Q00015_SweetWhispers;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.quest.Quest;
  23. import com.l2jserver.gameserver.model.quest.QuestState;
  24. import com.l2jserver.gameserver.model.quest.State;
  25. /**
  26. * Sweet Whisper (15)<br>
  27. * Original jython script by disKret.
  28. * @author nonom
  29. */
  30. public class Q00015_SweetWhispers extends Quest
  31. {
  32. // NPCs
  33. private static final int VLADIMIR = 31302;
  34. private static final int HIERARCH = 31517;
  35. private static final int M_NECROMANCER = 31518;
  36. public Q00015_SweetWhispers()
  37. {
  38. super(15, Q00015_SweetWhispers.class.getSimpleName(), "Sweet Whispers");
  39. addStartNpc(VLADIMIR);
  40. addTalkId(VLADIMIR, HIERARCH, M_NECROMANCER);
  41. }
  42. @Override
  43. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  44. {
  45. String htmltext = event;
  46. final QuestState st = getQuestState(player, false);
  47. if (st == null)
  48. {
  49. return htmltext;
  50. }
  51. switch (event)
  52. {
  53. case "31302-01.html":
  54. st.startQuest();
  55. break;
  56. case "31518-01.html":
  57. if (st.isCond(1))
  58. {
  59. st.setCond(2);
  60. }
  61. break;
  62. case "31517-01.html":
  63. if (st.isCond(2))
  64. {
  65. st.addExpAndSp(350531, 28204);
  66. st.exitQuest(false, true);
  67. }
  68. break;
  69. }
  70. return htmltext;
  71. }
  72. @Override
  73. public String onTalk(L2Npc npc, L2PcInstance player)
  74. {
  75. String htmltext = getNoQuestMsg(player);
  76. final QuestState st = getQuestState(player, true);
  77. if (st == null)
  78. {
  79. return htmltext;
  80. }
  81. final int npcId = npc.getId();
  82. switch (st.getState())
  83. {
  84. case State.COMPLETED:
  85. htmltext = getAlreadyCompletedMsg(player);
  86. break;
  87. case State.CREATED:
  88. if (npcId == VLADIMIR)
  89. {
  90. htmltext = (player.getLevel() >= 60) ? "31302-00.htm" : "31302-00a.html";
  91. }
  92. break;
  93. case State.STARTED:
  94. switch (npcId)
  95. {
  96. case VLADIMIR:
  97. if (st.isCond(1))
  98. {
  99. htmltext = "31302-01a.html";
  100. }
  101. break;
  102. case M_NECROMANCER:
  103. switch (st.getCond())
  104. {
  105. case 1:
  106. htmltext = "31518-00.html";
  107. break;
  108. case 2:
  109. htmltext = "31518-01a.html";
  110. break;
  111. }
  112. break;
  113. case HIERARCH:
  114. if (st.isCond(2))
  115. {
  116. htmltext = "31517-00.html";
  117. }
  118. break;
  119. }
  120. break;
  121. }
  122. return htmltext;
  123. }
  124. }