Q00122_OminousNews.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.Q00122_OminousNews;
  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. * Ominous News (122)<br>
  27. * Original Jython script by Polo.
  28. * @author malyelfik
  29. */
  30. public class Q00122_OminousNews extends Quest
  31. {
  32. // NPCs
  33. private static final int MOIRA = 31979;
  34. private static final int KARUDA = 32017;
  35. public Q00122_OminousNews()
  36. {
  37. super(122, Q00122_OminousNews.class.getSimpleName(), "Ominous News");
  38. addStartNpc(MOIRA);
  39. addTalkId(MOIRA, KARUDA);
  40. }
  41. @Override
  42. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  43. {
  44. final QuestState st = getQuestState(player, false);
  45. if (st == null)
  46. {
  47. return getNoQuestMsg(player);
  48. }
  49. switch (event)
  50. {
  51. case "31979-02.htm":
  52. st.startQuest();
  53. break;
  54. case "32017-02.html":
  55. st.giveAdena(8923, true);
  56. st.addExpAndSp(45151, 2310);
  57. st.exitQuest(false, true);
  58. break;
  59. }
  60. return event;
  61. }
  62. @Override
  63. public String onTalk(L2Npc npc, L2PcInstance player)
  64. {
  65. String htmltext = getNoQuestMsg(player);
  66. final QuestState st = getQuestState(player, true);
  67. if (st == null)
  68. {
  69. return htmltext;
  70. }
  71. switch (npc.getId())
  72. {
  73. case MOIRA:
  74. switch (st.getState())
  75. {
  76. case State.CREATED:
  77. htmltext = (player.getLevel() >= 20) ? "31979-01.htm" : "31979-00.htm";
  78. break;
  79. case State.STARTED:
  80. htmltext = "31979-03.html";
  81. break;
  82. case State.COMPLETED:
  83. htmltext = getAlreadyCompletedMsg(player);
  84. break;
  85. }
  86. break;
  87. case KARUDA:
  88. if (st.isStarted())
  89. {
  90. htmltext = "32017-01.html";
  91. }
  92. break;
  93. }
  94. return htmltext;
  95. }
  96. }